<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>18483</bug_id>
          
          <creation_ts>2012-08-03 17:45:52 +0000</creation_ts>
          <short_desc>[Shadow]: Shared stylesheets may make @host ambiguous</short_desc>
          <delta_ts>2013-04-01 22:48:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>16009</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>jackalmage</cc>
    
    <cc>sorvell</cc>
    
    <cc>tasak</cc>
    
    <cc>tross</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>71822</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-03 17:45:52 +0000</bug_when>
    <thetext>Since bug 15818, we now have the ability to share stylesheets across instances of shadow DOM. 

For example, a widget library could only have one stylesheet to style all widgets. This creates a potential issue, where it&apos;s hard to tell which widget&apos;s host the @host at-rule refers to.

This sounds bad and in need of fixin&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71827</commentid>
    <comment_count>1</comment_count>
    <who name="Tony Ross [MSFT]">tross</who>
    <bug_when>2012-08-03 18:56:09 +0000</bug_when>
    <thetext>Presumably the host element contains some piece of information (e.g. a class or attribute) which identified it as a particular widget type in the first place. 

Perhaps if @host was expanded to allow selector blocks for clarifying which host should match (think elm.matchesSelector) this would be solved. If I understand correctly, this aligns with Roland&apos;s original proposal for @host in bug 16519:

&gt; Another brainstorming thought: what about a @host rule instead? This would have
&gt; the advantage that the breaking behavior is explicit, and makes sure only the
&gt; host element is affected (rules inside @host can match the host element only)
&gt; E.g.:
&gt; 
&gt; @host {
&gt;   div { background-color: white; }
&gt;   .warning { background-color: yellow; }
&gt;   .important .warning { background-color: orange; }
&gt; }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71829</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-03 19:15:38 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Presumably the host element contains some piece of information (e.g. a class or
&gt; attribute) which identified it as a particular widget type in the first place. 
&gt; 
&gt; Perhaps if @host was expanded to allow selector blocks for clarifying which
&gt; host should match (think elm.matchesSelector) this would be solved. If I
&gt; understand correctly, this aligns with Roland&apos;s original proposal for @host in
&gt; bug 16519:
&gt; 
&gt; &gt; Another brainstorming thought: what about a @host rule instead? This would have
&gt; &gt; the advantage that the breaking behavior is explicit, and makes sure only the
&gt; &gt; host element is affected (rules inside @host can match the host element only)
&gt; &gt; E.g.:
&gt; &gt; 
&gt; &gt; @host {
&gt; &gt;   div { background-color: white; }
&gt; &gt;   .warning { background-color: yellow; }
&gt; &gt;   .important .warning { background-color: orange; }
&gt; &gt; }

It sounds like Roland was right :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71860</commentid>
    <comment_count>3</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-06 21:26:34 +0000</bug_when>
    <thetext>Sakamoto-san -- heads up. A huge update to how @host works is coming.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71880</commentid>
    <comment_count>4</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-08-07 11:03:49 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Sakamoto-san -- heads up. A huge update to how @host works is coming.

Thank you. I updated my WIP patch and my design doc.

Best regards,
Takashi Sakamoto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71947</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-08 20:54:20 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/aadaf5d62fff</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82424</commentid>
    <comment_count>6</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2013-01-31 19:25:52 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; http://dvcs.w3.org/hg/webcomponents/rev/aadaf5d62fff

Based on the recent internal thread, I suggest a slightly different syntax.  (Sorry for not getting to this earlier - I&apos;ve been laboring under a mistaken idea of what @host does!)

I believe the syntax should instead be:

@host &lt;selector&gt;? { &lt;declaration-list&gt; }

If the selector is omitted, it defaults to &quot;*&quot;.

This allows us to still address this bug&apos;s issue just as easily as before, but it makes the simple case (when you are only styling one type of element) easier to write.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82478</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-02-01 17:30:07 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; http://dvcs.w3.org/hg/webcomponents/rev/aadaf5d62fff
&gt; 
&gt; Based on the recent internal thread, I suggest a slightly different syntax. 
&gt; (Sorry for not getting to this earlier - I&apos;ve been laboring under a mistaken
&gt; idea of what @host does!)
&gt; 
&gt; I believe the syntax should instead be:
&gt; 
&gt; @host &lt;selector&gt;? { &lt;declaration-list&gt; }
&gt; 
&gt; If the selector is omitted, it defaults to &quot;*&quot;.
&gt; 
&gt; This allows us to still address this bug&apos;s issue just as easily as before,
&gt; but it makes the simple case (when you are only styling one type of element)
&gt; easier to write.

I would _really_ like to keep the syntax the same as before. At-rules are confusing enough, and the space between @host and &lt;selector&gt; has been perceived as a descendant combinator by several folks. Not that the nested parens is much better :-\</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82479</commentid>
    <comment_count>8</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2013-02-01 18:50:50 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; &gt; (In reply to comment #5)
&gt; &gt; &gt; http://dvcs.w3.org/hg/webcomponents/rev/aadaf5d62fff
&gt; &gt; 
&gt; &gt; Based on the recent internal thread, I suggest a slightly different syntax. 
&gt; &gt; (Sorry for not getting to this earlier - I&apos;ve been laboring under a mistaken
&gt; &gt; idea of what @host does!)
&gt; &gt; 
&gt; &gt; I believe the syntax should instead be:
&gt; &gt; 
&gt; &gt; @host &lt;selector&gt;? { &lt;declaration-list&gt; }
&gt; &gt; 
&gt; &gt; If the selector is omitted, it defaults to &quot;*&quot;.
&gt; &gt; 
&gt; &gt; This allows us to still address this bug&apos;s issue just as easily as before,
&gt; &gt; but it makes the simple case (when you are only styling one type of element)
&gt; &gt; easier to write.
&gt; 
&gt; I would _really_ like to keep the syntax the same as before. At-rules are
&gt; confusing enough, and the space between @host and &lt;selector&gt; has been
&gt; perceived as a descendant combinator by several folks. Not that the nested
&gt; parens is much better :-\

It&apos;s not a huge deal.  I&apos;m okay if it stays the way it is; the current syntax makes sense, it&apos;s just suboptimal in the common case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83469</commentid>
    <comment_count>9</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-02-21 02:48:11 +0000</bug_when>
    <thetext>The (In reply to comment #8)
&gt; (In reply to comment #7)
&gt; &gt; (In reply to comment #6)
&gt; &gt; &gt; (In reply to comment #5)
&gt; &gt; &gt; &gt; http://dvcs.w3.org/hg/webcomponents/rev/aadaf5d62fff
&gt; &gt; &gt; 
&gt; &gt; &gt; Based on the recent internal thread, I suggest a slightly different syntax. 
&gt; &gt; &gt; (Sorry for not getting to this earlier - I&apos;ve been laboring under a mistaken
&gt; &gt; &gt; idea of what @host does!)
&gt; &gt; &gt; 
&gt; &gt; &gt; I believe the syntax should instead be:
&gt; &gt; &gt; 
&gt; &gt; &gt; @host &lt;selector&gt;? { &lt;declaration-list&gt; }
&gt; &gt; &gt; 
&gt; &gt; &gt; If the selector is omitted, it defaults to &quot;*&quot;.
&gt; &gt; &gt; 
&gt; &gt; &gt; This allows us to still address this bug&apos;s issue just as easily as before,
&gt; &gt; &gt; but it makes the simple case (when you are only styling one type of element)
&gt; &gt; &gt; easier to write.
&gt; &gt; 
&gt; &gt; I would _really_ like to keep the syntax the same as before. At-rules are
&gt; &gt; confusing enough, and the space between @host and &lt;selector&gt; has been
&gt; &gt; perceived as a descendant combinator by several folks. Not that the nested
&gt; &gt; parens is much better :-\
&gt; 
&gt; It&apos;s not a huge deal.  I&apos;m okay if it stays the way it is; the current
&gt; syntax makes sense, it&apos;s just suboptimal in the common case.

I agree with Tab here but feel more strongly about it.

Let&apos;s imagine this common case: I want to style the background color of my host element. With the current syntax, this simple rule is much more difficult to construct than it should be.

@host {
  * {
    background: tomato;
  }
}

With the proposed optional syntax, this is:

@host {
  background: tomato;
}

Personally, I think the optional selector in the proposed syntax is ok, but if it&apos;s deemed too confusing (it does look like a descendent selector) perhaps just this common case could be supported and for further qualification of the rule you would use the original nested syntax.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85336</commentid>
    <comment_count>10</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-04-01 22:48:21 +0000</bug_when>
    <thetext>See follow up discussion in bug 21391.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>