Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Clarify behavior of HTML tags within the <title> element (Issue #36702) #36827

Merged
merged 14 commits into from
Dec 2, 2024

Conversation

bhawnajaiswal
Copy link
Contributor

Description

This pull request addresses Issue #36702 by updating the documentation for the <title> element to clarify that HTML tags within the <title> are treated as plain text and not parsed as HTML.

Motivation

This change ensures developers understand the behavior when using HTML tags in the <title>.

Additional details

Issue #36702

Related issues and pull requests

Fixes #36702

@bhawnajaiswal bhawnajaiswal requested review from a team as code owners November 17, 2024 08:34
@bhawnajaiswal bhawnajaiswal requested review from sideshowbarker and estelle and removed request for a team November 17, 2024 08:34
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs labels Nov 17, 2024
@github-actions github-actions bot added the size/s [PR only] 6-50 LoC changed label Nov 17, 2024
@@ -8,7 +8,7 @@ browser-compat: api.HTMLTitleElement.text

{{APIRef("HTML DOM")}}

The **`text`** property of the {{domxref("HTMLTitleElement")}} interface represents the text of the document's title. Only the text part is included; tags within the element and their content are stripped and ignored.
The **`text`** property of the {{domxref("HTMLTitleElement")}} interface represents the text of the document's title.It only contains text; If HTML tags are included within the <title> element, they are also treated as a plain text, rather than being interpreted as HTML.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[markdownlint] reported by reviewdog 🐶
MD033/no-inline-html Inline HTML [Element: title]

```

As you can see, the tag `span` and its content were skipped.
As you can see, The 'span' tag and its content were treated as plain text and displayed exactly as they appear in the <title> element, rather than being processed as HTML.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[markdownlint] reported by reviewdog 🐶
MD033/no-inline-html Inline HTML [Element: title]

@sideshowbarker sideshowbarker removed their request for review November 17, 2024 17:54
Copy link
Contributor

github-actions bot commented Nov 17, 2024

Preview URLs

(comment last updated: 2024-12-02 14:04:54)

```

As you can see, the tag `span` and its content were skipped.
As you can see, The `span` tag and its content were treated as plain text and displayed exactly as they appear in the `title` element, rather than being processed as HTML.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As you can see, The `span` tag and its content were treated as plain text and displayed exactly as they appear in the `title` element, rather than being processed as HTML.
As you can see, the `span` tag and its content were treated as plain text and displayed exactly as they appear in the `title` element, rather than being processed as HTML.

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you. I made some suggestions, including adding a sample setter in addition to your fixed getter.

bhawnajaiswal and others added 3 commits November 28, 2024 02:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bhawnajaiswal and others added 3 commits November 28, 2024 22:25
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@bhawnajaiswal
Copy link
Contributor Author

Hi @estelle ,
Thanks a lot for your helpful suggestions. I have reviewed and committed all the suggested changes to the file.

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Also, congratulations on your first merged MDN content PR. Welcome to the team!

@estelle estelle merged commit 396bda9 into mdn:main Dec 2, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tags within the title element, whose their content are converted to strings rather than ignored.
3 participants