[Bug 27420] New: [Custom]: need a hook for transfering data while cloning elements

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27420

            Bug ID: 27420
           Summary: [Custom]: need a hook for transfering data while
                    cloning elements
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
          Assignee: dglazkov@chromium.org
          Reporter: d@domenic.me
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, public-webapps@w3.org
            Blocks: 14968

Many elements have internal state that should be cloned when using
`cloneNode()`. From https://dom.spec.whatwg.org/#concept-node-clone:

> Run any cloning steps defined for node in other applicable specifications and pass copy, node, document and the clone children flag if set, as parameters. 

For example in HTML the input element specifies:

> The cloning steps for input elements must propagate the value, dirty value flag, checkedness, and dirty checkedness flag from the node being cloned to the copy.

This behavior should be hookable by authors as well for their custom elements.


My proposal is that we introduce a clonedCallback(source, dest) that, for
cloned nodes, is called after the createdCallback with the original as the
source and the new clone as the dest.

Ideally (probably later) we should also redefine DOM to delegate to
clonedCallback instead of to "other applicable specifications" and then HTML
should specify the clonedCallback behavior instead of specifying "the cloning
steps". That way if you e.g. create a custom element that extends an input
element you can call `super.clonedCallback(source, dest)` inside your own
`clonedCallback`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Monday, 24 November 2014 17:35:17 UTC