Re: [whatwg] Styling form controls (Was: Re: Forms-related feedback)

On Thu, Dec 5, 2013 at 5:30 AM, Ian Hickson <ian@hixie.ch> wrote:
> On Tue, 3 Dec 2013, Dimitri Glazkov wrote:
>> > >
>> > > Yeah, the idea is you'd bind to the scroll box to change the whole
>> > > scroll UI, but you could also then override specific pseudos of the
>> > > scroll box to style subparts of the default (or custom) scrollbox
>> > > UI. This part was never very well developed though since the core of
>> > > XBL2 was never picked up. But I think the same approach should
>> > > probably still work with the newer Web components work, no? It needs
>> > > to be specified and implemented...
>> >
>> > Web components can't define pseudo elements. So no.
>> >
>> > This sadly also means that you can't write a CSS which styles the
>> > default UA UI if that is used, and styles an attached Shadow DOM if
>> > that is used.
>>
>> That's simply not true. Where'd you get that?
>>
>> http://www.w3.org/TR/shadow-dom/#custom-pseudo-elements
>> http://robdodson.me/blog/2013/11/15/the-cat-and-the-hat-css-selectors/
>
> The key feature here isn't defining _new_ pseudo-elements, but being able
> to map specific elements in the shadow tree to predefined standard
> pseudo-elements, in particular, the same pseudo-elements that the standard
> binding exposes.
>
> If such a feature is available, then the HTML spec could list which of the
> standard pseudos each default binding is expected to expose, and then
> authors could style subparts of standard controls easily.

At least within normal author shadow doms, the intent is to simply
document what id/class values users of the component should target for
styling.

Instead of "foo-bar::baz", do "foo-bar ^ #baz" or similar.

Making this work for UA shadows is harder, because we don't want
to/aren't able to expose the entire shadow DOM.  We can either do
magic, or just give up and say that UA-defined controls get to have
pseudos without exposing the whole markup tree.

~TJ

Received on Thursday, 5 December 2013 23:31:13 UTC