- From: Anne van Kesteren <notifications@github.com>
- Date: Mon, 26 Oct 2020 10:01:32 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/pull/899/review/516983641@github.com>
@annevk commented on this pull request. I still need to read more, but this looks interesting and seems like a good iteration given the previous feedback of the approach being too high-level. Once thing that's not entirely clear to me is what the internal model of a part is and why having it is beneficial other than developer ergonomics. Does this enable any performance wins over mutating the tree yourself, for instance? > +a *DOM part group* was represented by a [template element](https://html.spec.whatwg.org/multipage/scripting.html#the-template-element). +This proposal keeps that approach possible but does not keep it the sole approach possible. + +### Interfaces + +```webidl +interface Part { + attribute any value; + void commit(); +}; + +interface NodePart : Part { + readonly attribute Node node; +}; + +interface AttributePart : NodePart { It's a bit confusing to me that an attribute is a node (whereas the DOM mostly tries to pretend it's not) and a child node is not. Perhaps that's not what NodePart means, but you would think it is given how AttributePart and ChildNodePart are named. > +and `AttributePart` for [`a` element](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element) as follows: +```js +namePart = new ChildNodePart(name) +emailPart = new ChildNodePart(link) +emailAttributePart = new AttributePart(link, ’href’) + +Then assigning values as follows will update the DOM: +namePart.value = "Ryosuke Niwa" +emailPart.value = "rniwa@webkit.org" +emailAttributePart.value = "mailto:rniwa@webkit.org" +``` + +The resultant DOM will look like this: +```html +<section><h1 id="name">Ryosuke Niwa</h1>Email: <a id="link" href="mailto:rniwa@webkit.org"></a></section> +``` Why does this work without commit? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/pull/899#pullrequestreview-516983641
Received on Monday, 26 October 2020 17:01:45 UTC