Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're using full-blown <a href="https://github.com/dglazkov/Web-Components-Polyfill" rel="nofollow">Web Components</a> instead of just Shadow DOM, you should be able to get at the parent taskbar element from the Javascript. Something like this:</p> <pre><code>&lt;element&gt; &lt;template&gt; ... &lt;/template&gt; &lt;script&gt; if (this !== window) { this.lifecycle({ created: function() { this.parentElement.attributes['side'].nodeValue; // "right" } }); } &lt;/script&gt; &lt;/element&gt; </code></pre> <p>This, however, makes it so that you can no longer use the applist component outside of a taskbar, which generally is a bad thing. We should try and make components as modular, independent, and reusable as possible. Ask yourself, "What exactly do I need to know about the parent element?" Could you instead write the applist as</p> <pre><code>&lt;applist scrollable="right"&gt;... </code></pre> <p>The duplication is a small price to pay for the ability to use this component anywhere you want. Who knows? In the future you may decide to use taskbar and applist in such a way that <code>side="right"</code> but <code>scrollable="bottom"</code>!</p> <p><strong>Update</strong></p> <p>If you want to allow the styling of the Shadow DOM elements to change dynamically with changes to the host element, you will soon be able to use the <a href="http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#host-at-rule" rel="nofollow">@host @-rule</a>. The spec isn't clear here at all, but I think it will be used like this (taken from <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=18483#c1" rel="nofollow">a comment on a bug for the W3 spec for Web Components</a>):</p> <pre><code>@host { div { background-color: white; } .warning { background-color: yellow; } .important .warning { background-color: orange; } } </code></pre> <p>This would (I think) give the host a default background color of white, which would be overriden to yellow if the host has the class <code>warning</code>. It would also style a warning element inside the host with a background color of orange <strong>if</strong> the host has the class <code>important</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload