-
Notifications
You must be signed in to change notification settings - Fork 171
If the HTML title contains character entities, the title bar / tab does not render correctly #185
Comments
This is the native behavior when entities are passed to @fernandosouza Could you add to Metal.js an |
Sure, @eduardolundgren. |
The specification for the title element says, "Titles may contain character entities (for accented characters, special characters, etc.), but may not contain other markup (including comments)." Is there a reason to retain all of the innerHTML of the title and then introduce the complexity of escaping the character entities? Additionally, the specification for a title setter says that it should behave as though you set the textContent, so shouldn't the virtual document work the same way? |
@holatuwol You're right, it's unnecessary complexity to unescape entities for that when we can use the title setter to do the job for us After some experiments here, I came to the following conclusion:
@fernandosouza We can prob go with the simpler fix of setting the title in the following way: var titleElement = document.getElementsByTagName('title')[0];
if (titleElement) {
titleElement.innerHTML = title;
} else {
document.title = title;
} wdyt? |
Expected behaviour
<title>left & right</title>
will render as "left & right" in the title bar, no matter how the page is loaded.Actual behaviour
<title>left & right</title>
will render as "left & right" in the title bar, only if the page is loaded directly. It will render as "left & right" if the page is loaded through Senna.jsThe text was updated successfully, but these errors were encountered: