Bug 24110 - cloneNode should call cloneElement and not the reverse
Summary: cloneNode should call cloneElement and not the reverse
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Julien Chaffraix
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-23 17:26 PST by Julien Chaffraix
Modified: 2009-03-12 05:43 PDT (History)
0 users

See Also:


Attachments
Trivial change: move cloneNode into cloneElement, updated cloneElement signature and call sites (8.66 KB, patch)
2009-02-24 01:54 PST, Julien Chaffraix
darin: review-
Details | Formatted Diff | Diff
Version updated that should address all Darin's comments (12.38 KB, patch)
2009-03-06 03:14 PST, Julien Chaffraix
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2009-02-23 17:26:34 PST
Suggested as part of the review of bug23956 as it would remove a static_cast.
Comment 1 Julien Chaffraix 2009-02-24 01:54:18 PST
Created attachment 27908 [details]
Trivial change: move cloneNode into cloneElement, updated cloneElement signature and call sites
Comment 2 Darin Adler 2009-02-24 09:06:31 PST
Comment on attachment 27908 [details]
Trivial change: move cloneNode into cloneElement, updated cloneElement signature and call sites

Thanks for doing this! I know I suggested it.

I do not like boolean arguments. I think they make call sites hard to read and understand.

I think we should leave the cloneChildNodes logic inside the cloneNode function, and then we would not need to add a boolean argument to cloneElement.

I also think that all the "shallow clone" comments at cloneElement call sites make it clear that it should be renamed to shallowCloneElement or cloneElementWithoutChildren, so we can remove those comments.

I think we should make the cloneNode virtual function override private, because if someone has an Element* it's a waste to have them make a virtual function call just to clone. Then, if we find callers that need a shallow clone, they can call the current cloneElement (perhaps under its new clearer name) and if we find callers that also want to clone the children, then I suggest we make a new non-virtual cloneElement call that does clone children.
Comment 3 Julien Chaffraix 2009-03-06 03:14:39 PST
Created attachment 28355 [details]
Version updated that should address all Darin's comments
Comment 4 Darin Adler 2009-03-06 07:11:37 PST
Comment on attachment 28355 [details]
Version updated that should address all Darin's comments

r=me
Comment 5 Julien Chaffraix 2009-03-12 05:43:11 PDT
Landed in r41621.