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)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Future

People

(Reporter: vladimire, Unassigned)

Details

Attachments

(1 file)

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
Attached file testcase
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...
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
So the question then is what NaN and Infinity get coerced to when passed through
XPConnect as an unsigned int....
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
Target Milestone: --- → Future
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
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
Resolution: WONTFIX → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: