You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could handle Nodes in a special manner where we just bind the live value directly as content. We would also want to consider whether a Node would be allowed as a value of an array.
Pros
Just let me do the thing!
Cons
Added complexity / surface area to maintain.
Could invite bad practices.
Typically easy to work around (create a template or use observe).
The text was updated successfully, but these errors were encountered:
💡 — Another option here would be to enable some sort of syntax that could act as a “callback when instantiated”. Either way, this ticket is really about gaining references to nodes to leverage imperative apis. Here’s an example of what that might look like:
constcallback=node=>{node.addEventListener('change',()=>console.log('changed!'));}html`<input(${callback})>`;// The “callback” method is called when the `input` is created.
Note that if a DOM node binding is reused within a template only the last occurrence will actually be displayed (because copies of the Node will not occur)
Perhaps if we used a DocumentFragment we could detect this case and throw
Current
We could handle
Node
s in a special manner where we just bind the live value directly as content. We would also want to consider whether aNode
would be allowed as a value of an array.Pros
Cons
observe
).The text was updated successfully, but these errors were encountered: