- From: Tomek Wytrębowicz <notifications@github.com>
- Date: Mon, 05 Dec 2016 15:36:46 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/609/265013596@github.com>
For me, it would be great to find the way to accomplish this with existing API, but in the way that does not look like a hack or have a big performance penalty. 1. The lest hacky solution that comes to my mind is to add `<link>` in (custom) elements Shadow DOM - http://jsbin.com/samegefezo/2/edit?html,output. But it sends a request for shared stylesheet twice. 2. Another solution that could solve double request problem is to wrap it with HTML Imports, but it becomes hacky, and HTML Imports are rather unsafe to rely on. 3. We can also request shared style together with custom-element definition, then in constructor clone it to the shadow root. But it works only for custom elements and adds a question, how expensive such cloning would be. We could also talk about cases when those styles are to be applied externally - not by the author of shadow root. Then, I would say that if you want to break the element's Shadow DOM encapsulation, hacking is what you want. Therefore, personally, I would feel fine to rely on hacky solution. If there is no good solution to achieve that with current spec, I would ask for new feature. If there is, I would say it would be nice to have it mentioned in an example in spec. The popularity of CSS frameworks shows that it's potentially a common case. Even tough, latest specs (Web Components, CSS Grid, etc.) reduces the need for them, we can safely assume developers will keep using frameworks, anyway. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/609#issuecomment-265013596
Received on Monday, 5 December 2016 23:37:48 UTC