<meta http-equiv> does nothing when inserted from a script
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
People
(Reporter: nox, Unassigned)
Details
Attachments
(1 file)
|
334 bytes,
text/html
|
Details |
I may be doing something wrong, but I can't seem to write any JS that inserts a <meta http-equiv=default-style> element in a document and have it take any effect.
See attachment, where the background becomes green in both Safari and Chrome.
Comment 1•7 years ago
|
||
I think this is a more general issue. Only nsContentSink::ProcessHeaderData calls Document::SetHeaderData, which is what sets the relevant thingie.
Can you confirm this also doesn't produce expected results for other <meta http-equiv=foo> tags?
Also, what does the spec say? Should meta tags react dynamically to DOM changes? The following also doesn't work, as expected:
<!doctype html>
<link rel="alternate stylesheet" title=green href="data:text/css,body{background:green;color:white}">
<meta http-equiv="default-style">
<body>
<script>document.querySelector("meta").content = "green"</script>
| Reporter | ||
Comment 2•7 years ago
|
||
Spec says that yes, it should react dynamically to DOM changes. Interestingly, it doesn't seem to say it should react to attribute changes, so I don't know if your own sample is a bug or intended.
Comment 3•7 years ago
|
||
The spec defines it as a side effect of insertion of the element, whereas in Gecko it seems to be a side effect of insertion of the element from the HTML parser?
Comment 4•7 years ago
|
||
(In reply to Anne (:annevk) from comment #3)
The spec defines it as a side effect of insertion of the element, whereas in Gecko it seems to be a side effect of insertion of the element from the HTML parser?
Yes, that's right.
Updated•7 years ago
|
Comment 5•7 years ago
|
||
Note that for some of them, like <meta http-equiv="content-security-policy"> and <meta name="viewport">, it happens on insertion in the document:
That sounds a bit fishy.
Comment 6•7 years ago
|
||
Some of the <meta> tag implementations predate the WhatWG HTML spec and were based on reverse-engineering existing browsers at the time. Others postdate the spec and were written based on the spec.
If other browsers match the spec for the ones that predate it (so the spec was based on those browsers, or they later changed to align with the spec), we should match too. If not, the spec should be changed accordingly.
Updated•7 years ago
|
Updated•4 years ago
|
Description
•