Re: [Shadow] URL-based shadows?
> On Mar 18, 2015, at 4:08 PM, Travis Leithead > wrote: > >> From: Ryosuke Niwa [mailto:rn...@apple.com] >> I think this idea resonates well with the cross-origin use case / API change >> proposal we made two years ago [1]. In that proposal, we went a step >> further and tied custom elements with URLs so that those shadow DOM can be >> automatically instantiated by simply using those custom elements. > > Thanks for the referral Ryosuke! > > In reading the proposal [1], I understood the following points (that > interested me anyway): > 1. Separate (isolated) script engine (your point #1 wanting to modify > imports). Facilitates iframe-like isolation between host and root to enable > cross-origin use case. > 2. Importing document manually declares the desired custom elements. Very > elegant. > 3. Shadow DOMs limited to custom elements. > 4. Many declarative extensions to template to enable custom element bindings. > I see you recognized template's powers at creating a non-rendered shadow-dom > already, and just took the leap to figure out how to auto bind them to custom > elements :-) > 5. Expose dataset to the root (even cross-domain) > > I'm not sure if you are still interested in pursuing all of these features, > or what their importance/weight is at this point (two years later). We’re still very much interested in pursuing this use case. > Some of my opinions, matching the numbering up to the above list: > 1. I think one of the things that makes web components separate and > interesting from existing iframes is the fact that they load and run "in > context", in other words, in the context of the global script engine of the > hosting page. I don't think there's anything inherently wrong with how > "components" loaded via iframes work today, so the cross-origin use case for > web components is not something I'm motivated to solve (using web > components). I suspect that a cross-origin use case is important, but its > level of integration will of necessity be more limited, and I suspect it will > lead to a different design than what we have with current web components. The reason I made that proposal was because we didn’t want to have two completely separate APIs for defining same-origin and cross-origin components. In the ideal world, we would have single component model that works across same-origin as well as cross-origin with varying degrees of freedom and restrictions. I agree that same-origin components that run in the context of the hosting document/page is a lot more interesting from spec and implementation complexity because it involves more complicated features of shadow DOM such as insertion points but that doesn’t preclude us from making sure cross-origin scenario works just as well. > 2.&4. I keep running into trouble when thinking about a declarative model for > web components because declarative models are based on persistent objects in > the DOM, and those persistent objects are fully mutable. In other words, you > have to either accept and spec accordingly what happens when key attributes > are changed (e.g., your "defines" and "interface" attributes), or you have to > limit mutability such that changes are only read-once (for example). I prefer > to let frameworks write the declarative syntactic sugar in the case of web > components, and steer clear of declarative models unless the mutability works > in favor of the proposal. This approach works for same-origin use cases but we couldn’t come up with a good imperative API for cross-origin scenarios. > 3. I don't have an opinion here yet. It seems like limiting to custom > elements makes shadow dom easier to implement. But I can also imagine cases > where the component really wants to hook up to an element like or > in order to extend its host's feature set. That use case comes up frequently on this list but I think that needs to be addressed by CSS-based decorators. If we let custom “appearance” add a JS API, then UA wouldn’t be able to rip it apart for accessibility or for new platforms. - R. Niwa
RE: [Shadow] URL-based shadows?
> From: Ryosuke Niwa [mailto:rn...@apple.com] >I think this idea resonates well with the cross-origin use case / API change >proposal we made two years ago [1]. In that proposal, we went a step further >and tied custom elements with URLs so that those shadow DOM can be >automatically instantiated by simply using those custom elements. Thanks for the referral Ryosuke! In reading the proposal [1], I understood the following points (that interested me anyway): 1. Separate (isolated) script engine (your point #1 wanting to modify imports). Facilitates iframe-like isolation between host and root to enable cross-origin use case. 2. Importing document manually declares the desired custom elements. Very elegant. 3. Shadow DOMs limited to custom elements. 4. Many declarative extensions to template to enable custom element bindings. I see you recognized template's powers at creating a non-rendered shadow-dom already, and just took the leap to figure out how to auto bind them to custom elements :-) 5. Expose dataset to the root (even cross-domain) I'm not sure if you are still interested in pursuing all of these features, or what their importance/weight is at this point (two years later). Some of my opinions, matching the numbering up to the above list: 1. I think one of the things that makes web components separate and interesting from existing iframes is the fact that they load and run "in context", in other words, in the context of the global script engine of the hosting page. I don't think there's anything inherently wrong with how "components" loaded via iframes work today, so the cross-origin use case for web components is not something I'm motivated to solve (using web components). I suspect that a cross-origin use case is important, but its level of integration will of necessity be more limited, and I suspect it will lead to a different design than what we have with current web components. 2.&4. I keep running into trouble when thinking about a declarative model for web components because declarative models are based on persistent objects in the DOM, and those persistent objects are fully mutable. In other words, you have to either accept and spec accordingly what happens when key attributes are changed (e.g., your "defines" and "interface" attributes), or you have to limit mutability such that changes are only read-once (for example). I prefer to let frameworks write the declarative syntactic sugar in the case of web components, and steer clear of declarative models unless the mutability works in favor of the proposal. 3. I don't have an opinion here yet. It seems like limiting to custom elements makes shadow dom easier to implement. But I can also imagine cases where the component really wants to hook up to an element like or in order to extend its host's feature set. 5. I like this. Though it's really only necessary for the cross-origin use case. [1] https://lists.w3.org/Archives/Public/public-webapps/2013OctDec/0418.html From: Ryosuke Niwa [mailto:rn...@apple.com] Sent: Wednesday, March 18, 2015 2:26 PM To: Travis Leithead Cc: Dimitri Glazkov (dglaz...@google.com); WebApps WG; Anne van Kesteren (ann...@annevk.nl); Arron Eicholz Subject: Re: [Shadow] URL-based shadows? On Mar 12, 2015, at 5:46 PM, Travis Leithead wrote: Has the idea of loading/parsing a Shadow DOM directly from a URL been discussed already? (e.g., a sort-of “micro-import” or an import that parses its document directly into the ShadowRoot container?) I’m curious to know if there’s some obvious flaw that I’m missing. element.createShadowRoot(“path to my component”); This is an idea around building components from the “inside out”, and using the URL as the basis for script-level access control to the Shadow contents. Hi Travis, I think this idea resonates well with the cross-origin use case / API change proposal we made two years ago [1]. In that proposal, we went a step further and tied custom elements with URLs so that those shadow DOM can be automatically instantiated by simply using those custom elements. e.g. if “like-button” element was defined in https://webkit.org/components.html, then we can use that component by simply "importing" the definition: https://webkit.org/components.html"; defines="like-button”> and using it in the same document (that imported components.html): https://build.webkit.org/";>Like build.webkit.org We thought this model was more developer friendly than having each user of the component manually create shadow root. We also didn’t want to make component authors deal with situations like a shadow root being attached to an iframe, input, etc.. [1] https://lists.w3.org/Archives/Public/public-webapps/2013OctDec/0418.html - R. Niwa
Re: [Shadow] URL-based shadows?
On Wed, Mar 18, 2015 at 2:35 PM, Travis Leithead < travis.leith...@microsoft.com> wrote: > I think ‘Worker’ threw me off at first J. > > > > My original use case was to make the current model of loading components > more “local”, as AFAIK, these components can only presently be loaded by > code you trust, e.g., via some script library somewhere imported via a >
Minuts IndieUI Teleconference 18 March 2015
http://www.w3.org/2015/03/18-indie-ui-minutes.html
RE: [Shadow] URL-based shadows?
I think ‘Worker’ threw me off at first ☺. My original use case was to make the current model of loading components more “local”, as AFAIK, these components can only presently be loaded by code you trust, e.g., via some script library somewhere imported via a
Re: template namespace attribute proposal
> On Mar 18, 2015, at 2:19 PM, Tab Atkins Jr. wrote: > > On Wed, Mar 18, 2015 at 2:06 PM, Ryosuke Niwa wrote: >> On Mar 16, 2015, at 3:14 PM, Tab Atkins Jr. wrote: >>> Karl Dubost said: The intersection seems to be: ['a', 'style', 'script', 'track', 'title', 'canvas', 'source', 'video', 'iframe', 'audio', 'font'] >>> >>> Whoops, sorry, forgot about . We can resolve that conflict in >>> favor of SVG; putting an html into a is, I suspect, >>> exceedingly rare. >> >> That may be true but the added complexity of inside a template >> element being special (i.e. it’s treated as SVG instead of HTML) may not be >> worth the effort. HTML parser is already complex enough that using a simple >> rule of always falling back to HTML if element names are ambiguous may >> result in a better overall developer ergonomics. > > Possibly, dunno. I could go either way. Consistently resolving > ambiguity in one direction could be simpler, but so could resolving in > favor of the massively-more-likely one. Spec/impl complexity isn't > really of concern here; impls would need an explicit list of > elements/namespaces anyway. The spec could possible get away with a > blanket statement, but that opens up the possibility of ambiguity, > like (which should clearly be SVG, despite the parser turning > it into for you). Implementation complexity isn’t my concern. Exception for will be yet another random fact Web developer needs to be aware of. In general, we have too much tolerance for complexity and exceptions to rules on the Web platform. We should strive to make the Web platform as simple as possible so that humans can comprehend. - R. Niwa
Re: [Shadow] URL-based shadows?
> On Mar 12, 2015, at 5:46 PM, Travis Leithead > wrote: > >Has the idea of loading/parsing a Shadow DOM directly from a URL been > discussed already? (e.g., a sort-of “micro-import” or an import that parses > its document directly into the ShadowRoot container?) I’m curious to know if > there’s some obvious flaw that I’m missing. > > element.createShadowRoot(“path to my component”); > > This is an idea around building components from the “inside out”, and using > the URL as the basis for script-level access control to the Shadow contents. Hi Travis, I think this idea resonates well with the cross-origin use case / API change proposal we made two years ago [1]. In that proposal, we went a step further and tied custom elements with URLs so that those shadow DOM can be automatically instantiated by simply using those custom elements. e.g. if “like-button” element was defined in https://webkit.org/components.html, then we can use that component by simply "importing" the definition: https://webkit.org/components.html"; defines="like-button”> and using it in the same document (that imported components.html): https://build.webkit.org/";>Like build.webkit.org We thought this model was more developer friendly than having each user of the component manually create shadow root. We also didn’t want to make component authors deal with situations like a shadow root being attached to an iframe, input, etc.. [1] https://lists.w3.org/Archives/Public/public-webapps/2013OctDec/0418.html - R. Niwa
Re: template namespace attribute proposal
On Wed, Mar 18, 2015 at 2:06 PM, Ryosuke Niwa wrote: > On Mar 16, 2015, at 3:14 PM, Tab Atkins Jr. wrote: >> Karl Dubost said: >>> The intersection seems to be: >>> ['a', 'style', 'script', 'track', 'title', 'canvas', 'source', 'video', >>> 'iframe', 'audio', 'font'] >> >> Whoops, sorry, forgot about . We can resolve that conflict in >> favor of SVG; putting an html into a is, I suspect, >> exceedingly rare. > > That may be true but the added complexity of inside a template > element being special (i.e. it’s treated as SVG instead of HTML) may not be > worth the effort. HTML parser is already complex enough that using a simple > rule of always falling back to HTML if element names are ambiguous may result > in a better overall developer ergonomics. Possibly, dunno. I could go either way. Consistently resolving ambiguity in one direction could be simpler, but so could resolving in favor of the massively-more-likely one. Spec/impl complexity isn't really of concern here; impls would need an explicit list of elements/namespaces anyway. The spec could possible get away with a blanket statement, but that opens up the possibility of ambiguity, like (which should clearly be SVG, despite the parser turning it into for you). ~TJ
Re: template namespace attribute proposal
> On Mar 16, 2015, at 3:14 PM, Tab Atkins Jr. wrote: > > [Sorry for the reply-chain breaking; Gmail is being super weird about > your message in particular, and won't let me reply directly to it. > Some bug.] > > Karl Dubost said: >> The intersection seems to be: >> ['a', 'style', 'script', 'track', 'title', 'canvas', 'source', 'video', >> 'iframe', 'audio', 'font'] > > Whoops, sorry, forgot about . We can resolve that conflict in > favor of SVG; putting an html into a is, I suspect, > exceedingly rare. That may be true but the added complexity of inside a template element being special (i.e. it’s treated as SVG instead of HTML) may not be worth the effort. HTML parser is already complex enough that using a simple rule of always falling back to HTML if element names are ambiguous may result in a better overall developer ergonomics. - R. Niwa