-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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]
…najaiswal/MDN-Web-Docs-Code into title-tagcontent-correction Updating branch
@@ -30,7 +30,7 @@ Metadata contains information about the page. This includes information about st | |||
| {{HTMLElement("link")}} | Specifies relationships between the current document and an external resource. This element is most commonly used to link to CSS but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. | | |||
| {{HTMLElement("meta")}} | Represents {{Glossary("Metadata","metadata")}} that cannot be represented by other HTML meta-related elements, like {{HTMLElement("base")}}, {{HTMLElement("link")}}, {{HTMLElement("script")}}, {{HTMLElement("style")}} and {{HTMLElement("title")}}. | | |||
| {{HTMLElement("style")}} | Contains style information for a document or part of a document. It contains CSS, which is applied to the contents of the document containing this element. | | |||
| {{HTMLElement("title")}} | Defines the document's title that is shown in a {{glossary("Browser", "browser")}}'s title bar or a page's tab. It only contains text; tags within the element are ignored. | | |||
| {{HTMLElement("title")}} | Defines the document's title that is shown in a {{glossary("Browser", "browser")}}'s title bar or a page's tab. It only contains text; html tags within the element are also treated as a plain text. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mdn-linter] reported by reviewdog 🐶
| {{HTMLElement("title")}} | Defines the document's title that is shown in a {{glossary("Browser", "browser")}}'s title bar or a page's tab. It only contains text; html tags within the element are also treated as a plain text. | | |
| {{HTMLElement("title")}} | Defines the document's title that is shown in a {{glossary("Browser", "browser")}}'s title bar or a page's tab. It only contains text; html tags within the element are also treated as a plain text. | |
``` | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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 #36702Related issues and pull requests
Fixes #36702