Open
Bug 1859297
Opened 1 year ago
Updated 8 months ago
Add lint rule to stop using .tagName as its case depends on XHTML/HTML-ness of the document, source casing, and element's namespace prefix
Categories
(Developer Infrastructure :: Lint and Formatting, enhancement)
Developer Infrastructure
Lint and Formatting
Tracking
(Not tracked)
NEW
People
(Reporter: Gijs, Unassigned)
References
(Blocks 1 open bug)
Details
There are a few different problems with .tagName
:
- its case differs for the same source code depending on whether it's used in an HTML or XHTML document (in HTML, it's always upper case, in XHTML, source case)
- changing the source case changes the case of
tagName
in XHTML documents (so other lint changes that e.g. enforce lowercasing tag names in the source markup can break JS checks using.tagName
) - it includes the namespace prefix if present in the XML case. So
<html:input>
and<input>
where the parent sets the namespace for children produce a differenttagName
value, even though both are HTML Input elements
The combination of these problems is going to bite us if we switch some of our XHTML docs to HTML, as existing checks will start failing because the value of tagName
will change, even though the markup won't.
We should probably just encourage people to use localName
combined with a namespaceURI
check if the namespace matters (it often doesn't).
Comment 1•1 year ago
|
||
The severity field is not set for this bug.
:andi, could you have a look please?
For more information, please visit BugBot documentation.
Flags: needinfo?(bpostelnicu)
Updated•8 months ago
|
Type: defect → enhancement
Flags: needinfo?(bpostelnicu)
You need to log in
before you can comment on or make changes to this bug.
Description
•