Closed Bug 119489 Opened 23 years ago Closed 23 years ago

script using insertBefore fails if second argument 'refnode' not provided (but it shouldn't always be requred!)

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: jrspm, Assigned: jst)

References

()

Details

Using build 2002011003 on Win2k (sp2)

the page http://www.webreference.com/js/column44/tablescript83.html which is an 
example script on how to use insertBefore fails in Mozilla but works just fine 
in IE5.5.  I get the following error in the javascript console:

Error: uncaught exception: [Exception... "Not enough arguments 
[nsIDOMHTMLTableElement.insertBefore]"  nsresult: "0x80570001 
(NS_ERROR_XPC_NOT_ENOUGH_ARGS)"  location: "JS frame :: 
http://www.webreference.com/js/column44/tablescript83.html :: <TOP_LEVEL> :: 
line 49"  data: no]

It looks like Mozilla refuses to take a call to insertBefore with a single 
argument.  Here is line 49:

returnValue = tableObj.insertBefore(tbodyObj);

Normally, you would provide a 'refnode' as a second argument and webreference 
does when it makes sense to do so.  Their explanation of the code is here:

http://www.webreference.com/js/column44/insertbefore.html

Now, this may be a dup of one of the following bugs, but I'm not sure:
http://bugzilla.mozilla.org/buglist.cgi?
bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&fi
eld0-0-0=product&type0-0-0=substring&value0-0-0=insertBefore&field0-0-
1=component&type0-0-1=substring&value0-0-1=insertBefore&field0-0-
2=short_desc&type0-0-2=substring&value0-0-2=insertBefore&field0-0-
3=status_whiteboard&type0-0-3=substring&value0-0-3=insertBefore

Anyway, I'm not positive about this, but it seems like this should work in 
Mozilla.  I'm hoping for an expert to validate my findings.

jake
This has been discussed in the DOM WG, and the conclusion was that all arguments
defined in the DOM spec need to be passed in, we won't deal with default values
for missing arguments. IE, and the testcase is broken. Marking INVALID.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
verified invalid based on johnny's comments.
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.