W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Opera's Proposal for :context Selector

From: Joshua Cranmer <Pidgeot18@verizon.net>
Date: Mon, 14 Jul 2008 19:07:47 -0400
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Andrew Fedoniouk <news@terrainformatica.com>, Lachlan Hunt <lachlan.hunt@lachy.id.au>, www-style <www-style@w3.org>
Message-id: <487BDC43.5060103@verizon.net>

Tab Atkins Jr. wrote:
>> Your advice? To use :context always? May work if you have a dedicated
>> community.
> You're still not understanding the use-case.  The problem isn't that a
> selector collision (both site template and user content have div.foo
> appearing in their markup) will cause the *user's* content to be
> styled inappropriately, it's that it will *also* cause the *site's*
> content to be styled inappropriately.
I think he understands it very well. What he's saying (and what I'm 
saying) is that the scoped stylesheet shouldn't know anything at all 
about the world outside it's little document fragment. A div.foo in the 
scoped stylesheet doesn't apply at all to *any* div outside of the scope 
fragment, whether as a member of the query or application. The proposal 
Andrew has (which I concur with) is to more or less imply a ":context" 
at the beginning of the selectors.
> As noted, this does *not* replicate the use of <style scoped>, and
> it's still more difficult than it could be.  Simply telling the user
> to put :scope/:context in front of their rule if it's displaying
> weirdly is simpler for them and doesn't require any special effort on
> your part. 
Which is the point Andrew's trying to make. In effect, the idea to make 
<style scoped> apply from the root document means that :context has to 
be prepended in most cases.
> In other words, it doesn't accomplish what <style scoped> does, and
> achieving this reduced functionality still either requires (possibly
> substantially) more work on the part of the users (who can't be relied
> on to do so, anyway) plus some minor work from the site owner, or a
> *great* amount of work from the site owner (in implementing and
> deploying a CSS parser than can reject/rewrite rules to ensure they
> only apply to the user's content).
The solution desired by Andrew (and I) is to simply make <style scoped> 
only cogniscent of the document fragment wherein it is contained. You've 
lost sight of the forest for trees, treating Andrew's examples of 
workarounds and their equivalents for the current status quo as the 
whole new proposal.

Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Received on Monday, 14 July 2008 23:08:18 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:38 UTC