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

Re: Shadow DOM: Hat and Cat -- if that's your real name.

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 6 Feb 2014 10:56:14 -0800
Message-ID: <CAAWBYDD2+j+A17evw5Z7tvbR7HjiokJdWT2bPe6O8fmxF6Mjnw@mail.gmail.com>
To: Sylvain Galineau <galineau@adobe.com>
Cc: "Edward O'Connor" <eoconnor@apple.com>, "<www-style@w3.org>" <www-style@w3.org>
On Wed, Feb 5, 2014 at 9:50 PM, Sylvain Galineau <galineau@adobe.com> wrote:
> On Feb 5, 2014, at 6:34 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Tue, Feb 4, 2014 at 8:08 PM, Sylvain Galineau <galineau@adobe.com> wrote:
>>> The issue is that you're not getting in the way of anyone deliberately hacking into components. Is there data suggesting deliberate styling of custom widgets is scarce?
>>
>> It's not scarce, but neither is it super-common.  :host()/:ancestor()
>> let components offer their own themes, which luckily removes a lot of
>> the need, but there are a signfiicant number of "structural"
>> components in Polymer, Brick, et al that are intended to be fully
>> styled by the developer instead.
>>
>> This is slightly misleading, though.  The major use-case for ^^ is to
>> style all components of a certain type in the page - you're using a
>> bunch of Polymer, and you want all the <polymer-button>s to look a
>> particular way, regardless of whether you put them in your page or
>> they're embedded deep in some component's shadow.  This *does* happen
>> a lot in practice, at least in the apps we've looked at, and it's
>> something that is *not* solved by any other approach so far.
>
> ‘A lot’ sounds misleading for something that doesn’t exist except as a polyfill the actual usage of which is rather uncertain. Some pointers to those apps to back up your claims would be helpful.

I'll have to defer to one of the Polymer folks on that.  I don't track
the repo closely enough to be able to rattle off examples.

>>>> If we try to be more restrictive *first*, it's extremely likely that
>>>> we'll get things wrong, and people will have to hack around our silly
>>>> limitations to achieve what they want.  I'd rather base the
>>>> restrictive models on data from actual usage than guesses about what's
>>>> good enough.  (And internal feedback from the Polymer team on our
>>>> previous attempts at more restrictive models shows that it's very easy
>>>> to get it wrong.)
>>>
>>> There is some gap between 'we may get it wrong' and 'nothing at all'. I agree there is significant risk in over-thinking it; we can see some of that on this very thread: "An attribute won't do, what if people want to expose most elements in their shadow tree?'. Well, maybe a lowly attribute is a fine escape hatch to start with before moving on to more elaborate solutions derived from real-world feedback?
>>
>> It's not enough of an escape-hatch, as we've discovered.
>>
>> A major problem is that ::part is an attractive nuisance.  It *looks*
>> great; even if you find some problems, it seems like they can be
>> patched.  However, it almost always only looks that way as long as
>> you're looking at things a *single* shadow tree deep.  As soon as you
>> start composing shadows, using components in the shadows of other
>> components, ::part starts creaking.  Further, components aren't only
>> used for the "big" things in your page - it can make sense to design
>> small components that just refactor parts of other components, and are
>> only ever used locally within that single component.  You quickly
>> build up way more nested trees than people naively imagine, and
>> dealing with ::part() and nested stuff and forwarding and all that
>> other crap suddenly becomes a *major* issue.
>>
>> We tried it. It doesn't work.  We're not really interested in trying
>> it again; at least, not as a blocker.  We'd like to get stuff out in
>> the wild so we can see how people outside of the Polymer dev team
>> really use components, and *then* design restricted versions based on
>> that knowledge.
>
> ‘As *we*’ve discovered’, ‘*We* tried it’: in case you haven’t picked up on it by now, your confidence in your own thing doesn’t cut the mustard. Please share the actual evidence this confidence is based on so the rest of us can draw our own conclusions?

How would you like this data?  Charts? Graphs? Video interviews from
usability-study participants?

We thought of this, we specced it, we *implemented* it, and then had
Polymer crank on it.  They reported back that it was too weak, and it
got in their way too often.  This is real-world experience, reported
in person.

I'm not sure what other kind of data I could provide.  I'm also not
sure why this standard of data is apparently inadequate; we regularly
make decisions based on less.  (Not saying that's great, just
complaining that you seem to be imposing an unrealistically high
standard here.)  In particular, any alternate suggestions in this
thread are based not on any experience at all, but just a very short
period of thought without much experience of the feature as a whole.
(That doesn't make them necessarily worse, but it does mean that any
data-measuring contests are already biased.)

>> Remember that the status quo is everything mixed together.  We're
>> already winning a *ton* by setting up the shadow boundaries as they
>> currently exist.
>>
>> Remember also that, while the status quo is terrible, it *also* kinda
>> works.  Not well - we can make the world much better - but it's not a
>> giant pit of failure either.  You can poke at everything in a jQuery
>> component, but they still get updated/etc without too much pain.  When
>> people break, they can choose to deal with it or just use an older
>> version of the component.  The same applies to Web Components, except
>> the *accidental* breakage should be effectively nil.
>
> I agree with that; it does kind of work today. But this sort of cuts both ways. If jQuery plug-ins manage to update with little pain, this suggests hacking into custom widgets may be a limited-enough thing to allow us to lock things down and open up later.

I don't see how it suggests that at all. You're jumping straight from
"jQuery widgets can update okay" to "nobody ever pokes at the
internals of a jQuery widget".  You're skipping at least three
alternate explanations:

1. People poke at internals, but most of the time they do so in minor
ways that doesn't cause breakage on upgrade.

2. People poke at internals enough to break things, but they fix their
code when they update.

3. People poke at internals enough to break things, and then just stop
updating when the breakage happens.

(The last, in particular, is probably true by default in most cases,
since the standard practice for using widgets is to download the
scripts to your own server.  Updating is a manual process, which is a
synonym for "basically never happens".)

None of these three explanations imply that it should be okay to
completely prevent poking around.

>>> So while I sympathize with your concern, my fear of picking a default we'll sorely regret later overrides it. I'd rather go the other way and start with full encapsulation; then validate various options to relax the model based on the real-world experience.
>>
>> We know for a fact that full encapsulation is far too limiting in
>> practice already.  We tried it for months, then we relaxed it with a
>> few variants of ::part(), then we relaxed it further with ^ and ^^,
>> and that was finally enough to do useful work with.
>
> Since I have no context on what was tried for months, by whom, how many times, and for what, ‘we know for a fact’ is not something I’m able to agree or disagree with in any way. Data, please.

I'm sorry that you feel the need to doubt me in this particular
instance, when we're nearly always willing to trust WG members when
they give implementation feedback.  I'm not sure what I did to provoke
this level of distrust, but there's not much I can do about it.

>> Many cases don't need all that power, and could be served by a less
>> powerful piercing mechanism.  But *enough* cases need the full power
>> that it would be harmful to the feature, I believe, to prevent them
>> from getting it.  Let's do the least magical thing now, and focus on
>> figuring out more carefully constructed things when we have data.
>
> Then please elaborate on those cases that need it; all I’m reading here are conclusions without any of the actual evidence that led to them. It’s quite likely they’re sound conclusions. But since you’ve working in the open it should be easy to reach their source. Any pointers?

I did elaborate, at the beginning of my previous email.  You responded
that my statements seemed misleading, and that you don't trust my
conclusions.

~TJ
Received on Thursday, 6 February 2014 18:57:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:18 UTC