Remove type="text/css" on <style> and <link> elements, and <xml-stylesheet> PIs in tree
Categories
(Core :: CSS Parsing and Computation, task, P3)
Tracking
()
People
(Reporter: bgrins, Unassigned)
References
Details
Attachments
(1 obsolete file)
+++ This bug was initially created as a clone of Bug #1542877 +++
This is another thing we could do to tighten up test boilerplate. See https://groups.google.com/d/msg/mozilla.dev.platform/2cDuT_sNZ-o/V4w-zBhCCQAJ.
| Reporter | ||
Comment 1•7 years ago
|
||
Cam, to confirm: this would only apply to <style> tags and not <?xml-stylesheet> or <link rel="stylesheet">, correct?
| Reporter | ||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
It should also apply to <link rel="stylesheet">. Not 100% sure about xml-stylesheets, but probably too.
Comment 3•7 years ago
|
||
As Emilio says, <link> defaults to type="text/css" if rel="stylesheet".
xml-stylesheet PIs have the same behavior. See https://searchfox.org/mozilla-central/source/dom/xml/XMLStylesheetProcessingInstruction.cpp#119 where an empty type is treated the same as "text/css".
Or for an experimental testcase:
data:text/xml,<?xml-stylesheet href="data:text/css,* { color: red }"?><root>text</root>
| Reporter | ||
Comment 4•7 years ago
|
||
Thanks! Updating the title to reflect this.
Comment 5•7 years ago
|
||
If you are looking for a linter, this outputs "true" if there is a type attribute on the wrong thing.
xmllint --html --xpath '//link[@rel="stylesheet"]/@type or //style/@type' index.html 2>/dev/null
It shouldn't be too hard to add a selector for the PI to that.
| Reporter | ||
Comment 6•7 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Description
•