External Styling for CustomElements V1 & ShadowDOM
问题 Whilst this may seem to be a duplicate question those asked previously have been based around Polymer, not native CustomElements, and this is about the css itself, not penetrating the ShadowDOM or Custom CSS Properties / Variables So here we have a simple Custom Element (note: as of writing this only works in newer Chrome versions) class StyleMe extends HTMLElement { constructor () { super(); let shadow = this.attachShadow({ mode: 'closed' }); shadow.appendChild(document.querySelector('#style