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

Re: [css-scoping] :host-context() feedback

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 23 Jul 2014 07:45:58 -0700
Message-ID: <CAAWBYDA7GRg_P7mQ6xFiLTCYB-ZFBw75F7D-UGU7kf+BuU+-9g@mail.gmail.com>
To: dgs700 <dgs700@gmail.com>
Cc: www-style list <www-style@w3.org>
On Thu, Jun 19, 2014 at 2:29 AM, dgs700 <dgs700@gmail.com> wrote:
> Hi there,
> Came across this one while doing research for my book on UI components:
> http://www.amazon.com/AngularJS-Web-Component-Development-Components/dp/0321969103
> I do hope the idea of shadow DOM CSS ascending the tree hierarchy is
> deleted.  This is what I will have to say about in my book:
> "Hopefully this one never sees the light of day in browser CSS standards! It
> is akin to JavaScript that pollutes the global context, and it violates the
> spirit of component encapsulation.  The use case being posited that page
> authors may choose to "opt-in" to styles provided by the component is
> extremely weak.  What is highly likely to happen is the same "path of least
> resistance" rushed development where off-shore developers mis-use the pseudo
> class to quickly produce the required visual effect.  Debugging and removing
> this crap later would be nothing short of nightmarish for the developer who
> ultimately must maintain the code."

There are many examples where the ability to style based on the
context you find yourself in is useful, which is what :host-context()
allows.  Like anything, it can be misused, but some effort has been
made to restrict the scope of this kind of abuse (by restricting the
argument to only compound selectors, so you can't rely on outer
document structure too much).

This selector isn't being removed, as it's been used to great effect
by existing early developers, such as the developers of Polymer.

(Early in the design process for this spec, I took a more hardline
approach and wanted stricter encapsulation.  Turns out that such a
position is simply too restrictive, and prevents people from doing a
number of very useful things.)

Received on Wednesday, 23 July 2014 14:46:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:44 UTC