Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Add support for shadow DOM. #20

Merged
merged 1 commit into from
Sep 2, 2013
Merged

Add support for shadow DOM. #20

merged 1 commit into from
Sep 2, 2013

Conversation

shans
Copy link
Contributor

@shans shans commented Sep 2, 2013

No description provided.

@dstoc
Copy link

dstoc commented Sep 2, 2013

lgtm

shans added a commit that referenced this pull request Sep 2, 2013
Add support for shadow DOM.
@shans shans merged commit 9c4c34a into googlearchive:master Sep 2, 2013
@dfreedm
Copy link
Contributor

dfreedm commented Sep 3, 2013

One nit here: A node can have N shadowroots stacked on top of each other from "oldest" to "youngest". To copy all the shadows, something like this is required:

function copyShadowRoot(node, sr) {
  if (sr) {
    // recreate shadowroot stack oldest -> youngest
    if (sr.olderShadowRoot) {
      copyShadowRoot(node, sr.olderShadowRoot);
    }
    var nsr = node.createShadowRoot();
    forEach(sr.children, function(c) { nsr.appendChild(sr.cloneNode(true) });
  }
}
copyShadowRoot(copyNode, node.shadowRoot);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants