Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

ShadyCSS scopes styles of templates, but their content is stamped outside the scope of the dom-module #17

Closed
valdrinkoshi opened this issue Oct 7, 2016 · 3 comments · Fixed by #79
Assignees

Comments

@valdrinkoshi
Copy link
Contributor

valdrinkoshi commented Oct 7, 2016

I'm stamping template's content into another node, but the ShadyCSS scopes styles to the dom-module.
In this example, I stamp and append a clone of the template into <body> after 300ms.
When forcing ShadyDOM and customElements, the stamped clone won't receive the correct .target style
http://jsbin.com/lobuna/22/edit?html,output

@valdrinkoshi
Copy link
Contributor Author

valdrinkoshi commented Jan 17, 2017

If the element is removed then added again to the document, style is correctly applied

  parent.appendChild(el);
  // Removing and adding again fixes the issue
  parent.removeChild(el);
  parent.appendChild(el);
}

@valdrinkoshi
Copy link
Contributor Author

@azakus updated jsbin after our offline discussion. Seems like style scoping update is not triggered for dynamically added elements

@dfreedm dfreedm self-assigned this Mar 24, 2017
@dfreedm
Copy link
Contributor

dfreedm commented Mar 24, 2017

The dynamic scoping mutation observer only removes scoping for nodes removed from an element, it doesn't check that it needs to remove scoping for added nodes.

Should be a simple fix.

dfreedm added a commit that referenced this issue Mar 24, 2017
Fixes #17

Also fix testing scenarios set by the test runner
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 a pull request may close this issue.

2 participants