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