16:02:35 RRSAgent has joined #webapps 16:02:35 logging to http://www.w3.org/2015/09/18-webapps-irc 16:06:11 dglazkov: ? 16:06:56 rniwa has joined #webapps 16:08:20 https://plus.google.com/hangouts/_/google.com/shadow-dom 16:08:34 https://www.w3.org/wiki/Webapps/WebComponentsSeptember2015Meeting 16:09:23 fantasai: ^^^ 16:09:52 arronei has joined #webapps 16:09:54 dglazkov has changed the topic to: Shadow DOM styling https://www.w3.org/wiki/Webapps/WebComponentsSeptember2015Meeting 16:10:32 thorton has joined #webapps 16:11:18 hi rniwa 16:12:19 https://etherpad.mozilla.org/shadow-dom 16:13:06 RRSAgent: make logs public 16:13:14 ScribeNick: fantasai 16:13:22 Topic: Shadow DOM Styling 16:14:17 rniwa: Topics are :host, :host-context, ::content, style attributes cascading, ???, Travis's inheritance by default, composition algorithm unwrapping socks(?) 16:14:34 rniwa: detached shadow.. what about replaced elements, SVG elements, MathML, etc. 16:14:42 s/socks(?)/slots/ 16:14:50 rniwa: finally [?] 16:15:12 Topic: :host() pseudo-class 16:15:27 It's unclear when you say "div :host" 16:15:32 what happens? 16:15:36 It doesn't match 16:15:38 IIRC 16:15:59 It's specced in terms of scoping 16:16:09 selectors in the Shadow DOM are scope-contained 16:16:18 but how is that spec'ed? The spec text says: "When evaluated in the context of a shadow tree, it matches the shadow tree’s host element if the host element, in its normal context, matches the selector argument. In any other context, it matches nothing." 16:17:04 discussion about "scope-contained" property of selectors 16:17:45 fantasai: Shadow DOM spec should be speccing that selectors in shadow tree are scope-contained 16:17:58 fantasai: You can't select an element outside the subtree that it's scoped to 16:18:27 elliott: What about :host-context() 16:19:02 fantasai: It doesn't match an element outside the scoping root, it's pulling info from outside it but it doesn't represent such an element 16:19:20 rniwa: CSS needs to be able to see not just composed tree, but also the original tree 16:19:31 rniwa: If you're only exposing compsed tree, a lot of these things don't exist 16:19:34 rniwa: we need to fix that 16:19:40 esprehn: We can fix the text. 16:19:46 esprehn: :host has nothing to do with the composed tree 16:19:56 esprehn: :host-context() operates on the composed tree 16:20:10 hgl has joined #webapps 16:20:48 annevk has joined #webapps 16:20:51 fantasai: :host-context() doesn't represent an element in the composed tree, it matches the :host ... if it happens to be in the context described (in the composed tree) 16:21:01 esprehn: It's matching the ancestor chain in the composed tree 16:21:30 esprehn: If you project a button into a toolbar through another widget, and the button says :host-context(toolbar) the button can add padding to itself when in a toolbar 16:21:45 16:21:56 x-panel contains 16:21:59 hober: Shouldn't the toolbar be providing padding? 16:22:07 x-button has :host-context(x-button) { ... } it must match 16:22:23 fantasai: That's not a good example. A different example would be :host-context(.light) vs :host-context(.dark) or different styling whether in main content area vs toolbar 16:22:35 ... 16:22:43 esprehn: Point is for widget to select styling based on the context 16:22:49 esprehn: To an author, the context is the composed tree 16:23:04 ... 16:23:15 rniwa: Shouldn't discuss whether composed tree or what tree, 16:23:21 rniwa: Changes style based on context 16:23:28 If the shadow tree is closed, can it still use :host and :host-context? 16:23:30 rniwa: If you have a button, it's always a button 16:23:38 rniwa: You can style the button 16:23:47 rniwa: Custom elements invovling shadow dom, pass certain variable into the component 16:24:03 rniwa: dark and light example, maybe you want to define theme color, which is dark or light. Goes into CSS variable and then styled 16:24:14 rniwa: Seems very weird that component needs to behave differently based on location in composed tree 16:24:19 rniwa: Seems anti-pattern to me 16:24:49 hober: I don't think :host-context is necessary because the stylesheet that defines the them sets a bunch of colors everywhere, and in some kind of shadow-styling world with name parts and vairable, for exposing parts of widget, cna style those parts 16:25:01 hober: Not responsibility of widget to say how ... 16:25:10 esprehn: We already have this in the platform 16:25:23 esprehn: form controls change their padding depending on whether it's likely to look bad 16:25:42 esprehn: E.g. if you put aqua buttons next to each other, they magically sprout margins to expand out 16:25:55 esprehn: You can solve it this way 16:26:05 hober: I don't think we should use quirky ems as a good example 16:26:35 ... 16:27:05 esprehn: Maybe this might be pushed to next level, but it's an author requirement 16:27:18 dglazkov: We don't have devs here, maybe table dthe discussion... 16:27:28 esprehn: We might want to re-evaluate once we have @apply rules. 16:27:33 esprehn: Mixins solve this in a similar way 16:27:45 esprehn: Toolbar could provide a mixin, and widget could accept the mixin 16:27:53 esprehn: So let's present that to authors and see what they say 16:28:02 Topic: ::content pseudo-element 16:28:02 Let's move onto ::content. 16:28:13 dglazkov: ::content changes drastically due to the way slotting works 16:28:20 dglazkov: I think this is a great opportunity to fix ::content 16:28:27 dglazkov: We have an opportunity to not unwrap nodes with slots 16:28:47 dglazkov: The content or slot pseudo-element could be defined as simply bypass all the slots, and go to the ??? 16:29:01 ::assigned 16:29:03 hober: It's like an assigned pseudo-element 16:29:10 ... 16:29:15 ::content .a { } 16:29:19 esprehn: The complication of ::content comes from the fact you can write something like this ^ 16:29:35 esprehn: You can put a descendant selector, which matches the composition, but arbitrarily deep 16:29:46 esprehn: The rules that apply to you can come from arbitrarily above you 16:29:51 kochi_home has joined #webapps 16:29:56 esprehn: It requires a very complicated ... to accumulate this 16:30:01 esprehn: If it could only match one level... 16:30:02 ::content(slot-1) > .a { } 16:30:05 esprehn: I'm not sure how you'd express this in CSS 16:30:09 ::slot .a 16:30:16 esprehn: But if you're like forced into always having a child combinator right off the end of it 16:30:23 esprehn: that makes it much simpler 16:30:31 esprehn: then you know that it is directly from where the element was distributed to 16:30:40 esprehn: From that slot, not from some random ancestor's distribution 16:30:45 .my-slot::slot .a 16:30:48 dglazkov: So inside of your shadow tree you would write something like 16:30:54 dglazkov: All it does is it goes through all the slots 16:31:02 dglazkov: And reaches the first non-slot thing and tries to match that 16:31:12 esprehn: Not sure I follow dglazkov 16:31:12
16:32:17 annevk: Are you considering whta would happen if the shadow DOM [??] 16:32:45 s/[??]/ 16:32:59 annevk: A shadow dom can be open or closed. Seems like nothing should work if it's closed, since should be undetectable 16:33:08 esprehn: That's how we implemented it 16:33:13 esprehn: otherwise you leak the widget 16:33:20 annevk: CSS spec doesn't account for this 16:33:26 esprehn: CSS spec predates closed shadow doms 16:33:40 ACTION TabAtkins Make CSS Scoping module account for lcosed Shadow DOMs 16:33:40 Error finding 'TabAtkins'. You can review and register nicknames at . 16:34:03 rniwa: One thing we need to do is rename ::context to ::assigned 16:34:07 s/context/content/ 16:34:15 ?: Or ::slot. Or something. 16:34:21 esprehn: I think ::slot is better 16:34:23 hober: ::slotted 16:34:35 dglazkov: ::assigned is better, you're operating on a slot 16:34:43 dglazkov: Otherwise you'll be writing ::slot::slot 16:34:54 esprehn: In practice people don't write slot 16:35:00 esprehn: You'd just write ::assigned 16:35:06 annevk: I think ::slot or ::slotted would be better 16:35:15 annevk: It's clearer that it relates to ShadowDOM 16:35:30 rniwa: I think of those options, I think ::slotted is better 16:35:43 rniwa: DOes anyone know why ::slotted doesn't take a functional syntax? 16:35:58 rniwa: It's magical think where lefthand side matchs to shadow dom, and righthand side matches to things in the slot 16:36:01 ::assigned-to(slot-1) 16:36:20 ::cue(.a .b) vs ::cue .a .b 16:36:35 rniwa: Inside a ShadowDOM you can have a slot 16:36:40 rniwa: In shadow host you can have children 16:36:49 rniwa: Some o f those children are assigned into one of those slots 16:36:56 rniwa: ::slotted is to style the children in those slots 16:37:05 This was done so you could add combinators 16:37:15 rniwa: So as it's currently specced, ::slotted on the righthandside will match against those children and its descendants 16:37:18 A way to style those children from inside the shadow DOM, right? 16:37:21 ::slotted(> .a) doesn't work, so it's ::slotted > .a 16:37:21 rniwa: If you had ... 16:37:35 as a assgiend node to a slot 16:37:43 then ::slotted span b would match b here 16:37:46 esprehn: It was not functional to use combinators 16:38:10 fantasai: You could certainly define a functional syntax that accepted combinators, e.g. :has() 16:38:44 ::cue(b) does the same thing though 16:38:55 b is in another tree 16:39:16 fantasai: explains how CSS pseudoelement(function) syntax works 16:40:16 {insert explanation of pseud-element syntax as tree-context-shifting combinator } 16:40:32 #awesome-slot::slotted(div) then? 16:40:45 ACTION TabAtkins define ::slotted in CSS Scoping text 16:40:45 Error finding 'TabAtkins'. You can review and register nicknames at . 16:41:12 ::slotted(div#awesome-slot) 16:41:13 hober: That's a div that got slotted into a slot that's called #awesome-slot 16:42:09 An example of creating a slot in shadow dom:
16:42:10 fantasai askes for a concerete example with ShadowDOM syntax 16:42:14 more typically you'd probably write slot[name=awesome]::slotted(div) 16:42:16 OK, cool 16:42:21 ah then yes #awesome-slot::slotted(div) 16:42:21 So the selectors for that would be 16:42:27 hober: so how would you write it if you have combinators to select descendants of the div? 16:42:40 div > #awesome-slot::slotted stuff-inside-awesomeslot 16:43:09 (except I didn't id to slot element so #awesome-slot doesn't quite work...) 16:43:13 esprehn: What you want here is you need some kind of implicit child combinator 16:43:19 esprehn: so that you can only select one level down 16:43:44 fantasai: One level down period, or one level of shadow down? 16:43:46 esprehn: One level period 16:43:58 rniwa: The tricky part is ... 16:44:00
=> 16:44:00 well, you can only slot children 16:44:16 #awesome-slot::slotted(div) > span { } 16:44:35 esprehn: I want to jump through the div that got slotted, and style stuff on the other side 16:44:57 #awesome-slot::slotted(div) a { } 16:45:03 esprehn: Complexity of ::content was that it didn't have to be a child combinator, coudl be a descendant combinator 16:45:44 dglazkov: That matches div that is slotted, then matching a child of that div 16:45:52 ::content > span { } 16:45:55 dglazkov: Devs wanted that, so that's why not built as a function 16:46:12 ::content a { } 16:46:14 esprehn: This replaced the pool of elements with things that were in that distribution 16:46:31 ?: N levels ... ???? 16:46:31 what about slot[name=awesome]::slotted(div NEW-SYNTAX a)? 16:46:42 N levels of shadow trees 16:47:09 annevk: It seems a little wierd that we have removed selector matching for things that have been distributed or slotted on the content side, but we keep it here in CSS 16:47:20 hober: Since we can only slot children, it would make sense to not be able to style arbitrary descendants 16:47:29 esprehn: You can't style only children. You can reslot a slot 16:47:36 esprehn: But somehow I need to be able to style those 16:47:44 esprehn: You have buttons into a panel. Panel moves into a toolbar. 16:47:52 esprehn: Toolbar wants to style buttons inside panen 16:47:58 esprehn: but its direct children are just more slots 16:48:10 ?: can't we just do it with variables? 16:48:15 esprehn: Variables requires explicit coordination. 16:48:19 ?: was dglazkov 16:48:24 s/wierd/weird/ 16:48:26 esprehn: If your toolbar was written with JQuery and buttons were Angular 16:48:35 esprehn: Allowing you to style conceptiually what are your children 16:48:39 esprehn: Your children in the composed tree 16:48:45 annevk: I'm not necessarily concerned with the children 16:48:49 annevk: The concer was more with the div bit 16:48:59 annevk: Not with the span, but with the div inside the the parentheses 16:49:08 annevk: That was the bit that seemed weird to me. 16:49:09 I agree with anne 16:49:18
16:49:21 esprehn: Maybe it's not clear here 16:49:26 esprehn: Given that example 16:49:28 ShadowRoot on 16:49:30 esprehn: Host has a shadow root 16:49:35 16:49:36 esprehn: Shadow root contains 16:49:43 esprehn: the div goes into that slot 16:49:50 esprehn: This widget wants to style the divs that go into its slot 16:49:53 ::slot(div > span) { } 16:50:02 16:50:06 ::slot div { style div } 16:50:22 ::slot div > span { style span } 16:50:23 ? 16:50:33 fantasai: inconsistent with ::cue 16:50:43 esprehn: Needs to behave differently whether ... slots or actual ... 16:50:53 hober: I like that the :slot pseudo does the eliding the fact that there are N slots 16:50:54 http://dev.w3.org/html5/webvtt/#the-cue-pseudo-element has functional :-/ 16:51:18 esprehn: Conesnsus from WG was changing ::cue syntax to use tree-switching behavior 16:51:21 ::cue b { } 16:51:24 annevk: Is that still possible to change? 16:52:01 fantasai: Didn't ::cue match against somethign that wasn't a tree? 16:52:04 annevk: It's a tree, just not a DOM tree 16:52:31 esprehn: The way that webkit does this, there's a shadow root, and we put divs or bold in it 16:52:36 esprehn: It's just anonymous content 16:52:48 dglazkov: Is this someting we have to figure out now? 16:52:55 dglazkov: Or go on rough consensus? 16:53:01 dglazkov: Proceed with this on www-style 16:53:18 alexrussel: Hear from ppl who actually use it? 16:53:47 dglazkov: This syntax is that we have for :;content, it's just , we're tryng to figure out whether ::cue will conform to that in the future 16:53:57 Topic: Style attributes in shadow DOM ordering proposal 16:54:17 hober: My main concern with this issue is that in a world without shadow DOM, there is already a cascading order 16:54:19 I'll have to bow out, getting close to dinner time here 16:54:26 Thanks for taking minutes fantasai, much appreciated 16:54:38 hober: The world with shadow dom should simply be adding to that order, not changing what order exists 16:55:12 hober: Option 2 and 3 reverse the nroder of normal attributes and normal attr 16:55:24 proposal is at https://github.com/w3c/webcomponents/issues/316 16:55:29 hober: Whatever we agree should be consistent with what we have 16:55:46 esprehn: Intent was that person on outside is assumed to have more knowledge than person on inside 16:55:53 https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order.md 16:56:02 esprehn: User of widget knows better what style should be than person who created widget 16:56:06 https://github.com/w3c/webcomponents/issues/316 16:56:06 esprehn: So this is trying to enforce that 16:56:29 Could someone clarify the current cascading order without shadow DOM? 16:56:36 http://www.w3.org/TR/css-cascade-4/#cascading 16:56:52 rune: Clarifies ordering in tree-of-trees, but doesn't clarify scoped 16:57:12 rniwa: Not clear it tells us which order these happen 16:57:31 rniwa: override is style attr? 16:57:34 http://www.w3.org/TR/CSS21/cascade.html#cascading-order 16:57:40 fantasai: style attr changes specificity, not origin 16:57:53 declarations from style attributes can be seen as author rules with infinite specificity 16:58:52 fantasai: The Cascade has several things that matter. Most important one is orign 16:59:12 fantasai: This is where things invert / are arbitrary. important vs. non-important is handled in origin 16:59:30 rune: Style attribute is only one part of what's handling 16:59:42 sorry 16:59:43 rune: ... ? 16:59:48 style attribute has its own spec: https://drafts.csswg.org/css-style-attr/#interpret 17:00:09 fantasai: Within a single origin the next thing that's important is scoping 17:00:36 fantasai: Inner scope win over outer scope, except for !important rules where outer scope wins ove rinner scope 17:00:51 fantasai: The next thing that's important is specificity 17:01:15 fantasai: if you have the same origin and the same scoping level, then you sort by specificity. 17:01:21 fantasai: Style attribute is the most specific selector 17:02:15 The cascade-4 says "Normal declarations from style attributes are considered to be scoped to the element with the attribute, whereas important declarations from style attributes are considered to be scoped to the root element." 17:02:32 so the style attribute was top of specificity in CSS 2, but 17:02:40 was boosted to the top of scope in cascade-4 17:03:12 So style attribute is not treated as a different scope as opposed to a different specificity? 17:03:21 s/not treated/treated/ 17:03:42 ... 17:03:49 esprehn: Someone from the outside applies 'display: flex' to something 17:03:56 esprehn: If you look at top of example 17:04:08 https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Shadow-DOM-Cascade-Order.md 17:04:29 esprehn: Example at top was ::slot menutiem { display flex } 17:04:38 esprehn: If menuitem set hidden attr, it would never apply 17:04:48 esprehn: The outer one would win, and that breaks all kinds of stuff 17:05:06 esprehn: The hidden attr fails to operate 17:05:30 ::slot div span { } 17:05:33 hober: I thought you said outer author knew more what should happen 17:05:36 esprehn: ... 17:05:39