W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

Re: Default value of cloneNode() parameter

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Mon, 20 Feb 2012 13:47:10 -0800
Message-ID: <CABNRm62ZByKVcBg0e-Wu6VaNPz-60bY5CDpjk5KAMhztF8w_ZA@mail.gmail.com>
To: Aryeh Gregor <ayg@aryeh.name>
Cc: Anne van Kesteren <annevk@opera.com>, Ms2ger <ms2ger@gmail.com>, Adam Barth <w3c@adambarth.com>, Alexey Proskuryakov <ap@webkit.org>, www-dom@w3.org
On Mon, Feb 20, 2012 at 9:39 AM, Aryeh Gregor <ayg@aryeh.name> wrote:
>
> 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.


FYI, IE9 also defaults 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.
>

I'd argue that cloneNode() is much more frequently used than importNode()
is. So changing the behavior of importNode() is probably easier than
changing that of cloneNode().

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.
>

Agreed.


> Are IE or WebKit willing to change their default?  Would Gecko or
> Opera prefer to default to true instead of matching IE/WebKit?
>

Given that WebKit and IE (when combined to have 70%+ market share) have
defaulted to false for years and Gecko and Opera mandated the parameter, I
don't see why we can change our behavior here.

- Ryosuke
Received on Monday, 20 February 2012 21:47:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:09 GMT