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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bhawnajaiswal
Copy link

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
@@ -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. |
Copy link
Contributor

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 🐶

Suggested change
| {{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. |

Copy link
Contributor

```

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.

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.
2 participants