Bug 78887 - Node.cloneNode's deep parameter should default to true
: Node.cloneNode's deep parameter should default to true
Product: WebKit
Classification: Unclassified
Component: HTML DOM
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To: Nobody
Depends on:
  Show dependency treegraph
Reported: 2012-02-17 02:29 PST by Vineet Chaudhary (vineetc)
Modified: 2013-10-21 07:10 PDT (History)
10 users (show)

See Also:

proposed patch (4.44 KB, patch)
2012-02-17 02:34 PST, Vineet Chaudhary (vineetc)
abarth: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vineet Chaudhary (vineetc) 2012-02-17 02:29:27 PST
Spec url : http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-clonenode
Comment 1 Vineet Chaudhary (vineetc) 2012-02-17 02:34:54 PST
Created attachment 127561 [details]
proposed patch

Proposed patch.
Comment 2 Vineet Chaudhary (vineetc) 2012-02-17 02:35:18 PST
See also : https://bugzilla.mozilla.org/show_bug.cgi?id=698381
Comment 3 Alexey Proskuryakov 2012-02-17 09:28:55 PST
In WebKit, the argument is already optional, so the bug title is confusing. Is the part in parentheses what you are actually changing here?

Unlike for Mozilla, defaulting to true changes behavior to exact opposite of what we had. Can the spec be fixed to match long-standing WebKit behavior instead?
Comment 4 Adam Barth 2012-02-17 10:49:13 PST
Comment on attachment 127561 [details]
proposed patch

We should ask for the spec to change to our existing behavior.
Comment 5 Aryeh Gregor 2012-02-20 09:07:13 PST
Testing: IE10 Developer Preview and Chrome 18 dev default to false.  Firefox 13.0a1 and Opera Next 12.00 alpha throw exceptions due to too few arguments.  So false is correct.  I've updated the spec:


Thanks for the feedback.
Comment 6 Alexey Proskuryakov 2012-02-20 09:12:15 PST
Thank you. This renders the bug invalid.
Comment 7 Aryeh Gregor 2012-02-20 09:40:43 PST
Anne and Ms2ger objected to my spec change, so I reverted it.  I started a thread on www-dom.  Implementer feedback would be highly appreciated: http://lists.w3.org/Archives/Public/www-dom/2012JanMar/0084.html
Comment 8 Alexey Proskuryakov 2012-02-20 10:15:01 PST
Feedback sent. We should consider diverging from DOM 4 even if it ends up specifying different behavior.
Comment 9 Alexey Proskuryakov 2012-05-14 13:49:16 PDT
*** Bug 86377 has been marked as a duplicate of this bug. ***
Comment 10 Ryosuke Niwa 2013-07-18 21:03:56 PDT
Blink changed its behavior in https://chromium.googlesource.com/chromium/blink/+/76c4cbdf9823988c787f3625365e2f25a325a172.
Comment 11 Alexey Proskuryakov 2013-07-19 09:36:34 PDT
Crazy. What is the value of specs if they can be changed to no longer match implementations, all for purely aesthetic reasons?
Comment 12 Ryosuke Niwa 2013-07-19 10:30:20 PDT
(In reply to comment #11)
> Crazy. What is the value of specs if they can be changed to no longer match implementations, all for purely aesthetic reasons?

Matches Firefox behavior now.
Comment 13 Alexey Proskuryakov 2013-07-19 10:33:50 PDT
It does now after a Firefox change. But WebKit was 100% compliant before, and Firefox wasn't compliant with either spec version.
Comment 14 Anne van Kesteren 2013-07-19 13:49:59 PDT
100% compliant seems dubious given that the argument was only recently made optional in the specification. That WebKit would simply use undefined as an implicit default everywhere was unfortunate, but given that nobody else did that I don't think we should have automatically accepted that as precedent as it's pretty bad API-wise.
Comment 15 Alexey Proskuryakov 2013-07-19 13:58:56 PDT
Anne, I think that you are talking about implementation details here. Observable behavior is that behavior of cloneNode() in WebKit was and remains compliant to DOM3, and DOM4 was written to specify something that did not match any browser.
Comment 16 Anne van Kesteren 2013-07-19 14:11:08 PDT
Whether your throw or not for omitted non-optional arguments is not an implementation detail. Before Web IDL bindings were badly defined, but that does not mean that how WebKit decided to the bindings needs to be the standard. If you think it should be, I hope you understand this is the wrong forum.
Comment 17 Anne van Kesteren 2013-10-21 07:10:08 PDT
See https://github.com/whatwg/dom/commit/70fdc5f9030c22c5ceca9e875e06f8b305529ef8