This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 6214 - insertRow without arguments
Summary: insertRow without arguments
Status: CLOSED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-10 15:15 UTC by Simon Pieters
Modified: 2010-10-04 14:49 UTC (History)
3 users (show)

See Also:


Attachments

Description Simon Pieters 2008-11-10 15:15:06 UTC
If you do insertRow() on a table without arguments, browsers do different things:

IE acts as if it were insertRow(-1).
Firefox throws a "Not enough arguments" exception.
WebKit/Opera act as if it were insertRow(0).

Currently Firefox seems closest to the spec. I find https://bugzilla.mozilla.org/show_bug.cgi?id=157578 which has 2 dups.
Comment 1 Cameron McCormack 2008-11-24 23:24:28 UTC
Jonas Sicking <http://www.w3.org/mid/63df84f0811110326y10c54af3y51c7e589852d9243@mail.gmail.com>:
> For what it's worth, I think this issue should be addressed by the
> WebIDL spec so that we don't have to define for each and every
> function what to do if not enough arguments are supplied.
>
> If we need different behavior for different functions (for, for
> example, compat reasons) then WebIDL should be given hooks for that,
> such as an [optional] keyword.

Agreed.  Operations are now defined to throw TypeError if insufficient arguments are thrown, and if optional arguments are actually wanted, [Optional] or overloading can be used to handle this.
Comment 2 Cameron McCormack 2008-11-24 23:36:59 UTC
(In reply to comment #1)
> Agreed.  Operations are now defined to throw TypeError if insufficient
> arguments are thrown ...

Er, if arguments are passed.