Closed
Bug 190847
Opened 22 years ago
Closed 12 years ago
document.styleSheets.item(String) should thrown an exception
Categories
(Core :: DOM: CSS Object Model, defect)
Tracking
()
RESOLVED
INVALID
Future
People
(Reporter: vladimire, Unassigned)
Details
Attachments
(1 file)
522 bytes,
text/html
|
Details |
if you try to access document.styleSheets.item() with some string as a parameter it returns the first style sheet. It should be throwing an exception
Reporter | ||
Comment 1•22 years ago
|
||
Comment 2•22 years ago
|
||
hmm.... document.styleSheets.item(0) and document.styleSheet.item("heh") should be equivalent -- the "heh" is cast to a number by the JS engine and its numeric value is 0. Not sure what Infinity and NaN are doing...
Comment 3•22 years ago
|
||
In JavaScript, if the string 'hah' is coerced to a Number, then NaN is the result: js> Number('hah'); NaN Whereas the empty string, or whitespace characters, get coerced to 0: js> Number(''); 0 js> Number('\n'); 0 js> Number('\t'); 0 Details: Section 9.3.1, "ToNumber Applied to the String Type" ECMA-262 Edition 3 Final, http://www.mozilla.org/js/language
Comment 4•22 years ago
|
||
So the question then is what NaN and Infinity get coerced to when passed through XPConnect as an unsigned int....
Comment 5•22 years ago
|
||
XPConnect uses JS_ValueToECMAUint32. So what ever that API does for that conversion, so will XPConnect, including failing if the function returns false. The key is probably here: http://lxr.mozilla.org/seamonkey/source/js/src/jsnum.c#703
Updated•22 years ago
|
Target Milestone: --- → Future
Updated•15 years ago
|
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
Comment 7•12 years ago
|
||
Web IDL says that "foo", NaN and Infinity all get converted to 0 when the type is "unsigned long" as it is for document.styleSheets.item().
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Updated•12 years ago
|
Resolution: WONTFIX → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•