Default value of cloneNode() parameter

WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=78887
Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=698381

Node.cloneNode() takes a boolean parameter, where true means it clones
all descendants too, and false means it doesn't.  DOM4 says the
parameter defaults to true, IE10 Developer Preview and Chrome 18 dev
default to true, and Firefox 13.0a1 and Opera Next 12.00 alpha make
the parameter mandatory.  IE10 also makes it default to false in IE7
browser mode and quirks document mode.  I just changed the spec to
require false, but Ms2ger and Anne disagreed, so I changed it back.
The arguments for requiring a default parameter of true are

1) cloneNode(false) isn't very useful, and is perhaps surprising, so
it would be better to make the parameter mandatory than to make it
default to false.

2) It's inconsistent with the second parameter of importNode(), which
defaults to true in both Gecko and WebKit, and is mandatory in IE and
Opera.

We clearly don't want cloneNode() and importNode() inconsistent, and
cloneNode(true) is likely more useful, so defaulting it to true makes
more sense.  But going against browsers isn't a great idea either.
Currently n.cloneNode() will either throw, or do something consistent
cross-browser (albeit maybe not so useful).  If some browsers make it
default to true instead of false, it will now silently do something
different in different browsers, which is IMO significantly worse.

Are IE or WebKit willing to change their default?  Would Gecko or
Opera prefer to default to true instead of matching IE/WebKit?
Implementer feedback requested.

Received on Monday, 20 February 2012 17:40:08 UTC