Closed
Bug 390816
Opened 18 years ago
Closed 13 years ago
setAttribute with ; doesn't work, NS_ERROR_DOM_INVALID_CHARACTER_ERR error
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: martijn.martijn, Unassigned)
Details
(Keywords: testcase)
Attachments
(1 file)
430 bytes,
text/html
|
Details |
See testcase, I get a js error with that testcase, because .setAttribute(';',';') isn't allowed. It works fine in IE and Opera.
Actual result:
<pre id="result" style="white-space: -moz-pre-wrap; width: 600px;">[Exception... "String contains an invalid character" code: "5" nsresult: "0x80530005 (NS_ERROR_DOM_INVALID_CHARACTER_ERR)" location: "file:///C:/Documents%20and%20Settings/mw/Bureaublad/attributes2.htm Line: 6"]</pre>
Expected result:
<pre id=result style="WIDTH: 600px" ;=";"></pre>
What is even more string with Mozilla is that, if the element already has an attribute named ';', then it suddenly does work in Mozilla without errors.
Comment 1•18 years ago
|
||
I guess that attribute name is rejected by MOZ_XMLCheckQName, but it works if the attribute already exists because InternalGetExistingAttrNameFromQName finds it in that case and we don't rely on MOZ_XMLCheckQName to validate the name (via nsContentUtils::CheckQName).
Updated•18 years ago
|
OS: Windows XP → All
Hardware: PC → All
![]() |
||
Comment 2•17 years ago
|
||
Sounds like MOZ_XMLCheckQName is buggy? Or perhaps we shouldn't use it in HTML?
Flags: blocking1.9?
Comment 3•17 years ago
|
||
MOZ_XMLCheckQName is fine, ";" isn't a valid character for an QName in XML. Note that DOM Level 3 Core only talks about checking for XML name validity (http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68F082). I'm fine with switching to HTML5 name checking in HTML documents instead (see http://www.whatwg.org/specs/web-apps/current-work/#attributes1). Don't think this should have a very high priority though :-).
not blocking since we're not even sure this is a bug. Feel free to renominate if we actually determine that we do want to make a change, and we can find sites out there that does depend on it. Likely this is only going to be [wanted-1.9] at the most though.
Flags: blocking1.9? → blocking1.9-
Updated•17 years ago
|
Summary: Settattribute with ; doesn't work, NS_ERROR_DOM_INVALID_CHARACTER_ERR error → setAttribute with ; or : doesn't work, NS_ERROR_DOM_INVALID_CHARACTER_ERR error
Comment 6•17 years ago
|
||
Don't think ';' and ':' are the same, one is a valid name start character and the other is not.
Summary: setAttribute with ; or : doesn't work, NS_ERROR_DOM_INVALID_CHARACTER_ERR error → setAttribute with ; doesn't work, NS_ERROR_DOM_INVALID_CHARACTER_ERR error
Comment 7•17 years ago
|
||
(In reply to comment #6)
> Don't think ';' and ':' are the same, one is a valid name start character and
> the other is not.
OK. They're both rejected by MOZ_XMLCheckQName, though (for different reasons, http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/parser/expat/lib/moz_extensions.c&rev=1.11&mark=76,113#61 ).
Comment 8•13 years ago
|
||
AFAICT, Gecko/WebKit/Presto and the spec align here, while IE9 (in quirks mode, note) is too lenient.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Comment 9•13 years ago
|
||
(Thanks to KWierso for checking IE)
Reporter | ||
Comment 10•13 years ago
|
||
Why not do the same as IE?
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Comment 11•13 years ago
|
||
Please send email to www-dom if you want this to change; I don't expect us to change this before the spec.
Status: REOPENED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 12•13 years ago
|
||
I don't want the spec to change, I want Mozilla to change (perhaps).
If we believe the spec is wrong, we should be advocating to change it.
If we don't believe the spec is wrong, we should not be behaving differently.
Reporter | ||
Comment 14•13 years ago
|
||
The spec should do what browsers are doing, not the other way around.
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•