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
{{ message }}
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.
The meta functionality has evolved from its initial concept of being a mechanism that provides access to simply get information from a DOM node to being used more generally for both reading information and also writing/adding information to DOM nodes created by the virtual DOM system.
For reading information, such as Dimensions and IntersectionObserver using this.meta during the render lifecycle seems to provides adequate ergonomics and functionality.
However, when used to "set" properties or "add" functionality to a DOM node it feels clunky to need to do this in a decoupled programmatic fashion and not declaratively when using v() for the required node.
By adding a concept of an applicator, it will enable declaring meta functionality directly on the node(s) that they are needed.
The VDom applicators are not limited to just metas, but will enable consumers to write other extended functionality to hook into the vdom rendering system, for example, custom application (or diffing strategy) for a specific attribute or property.
// Only adds classes to the Node (example only)functionclasses(classes: string[]){return{apply(domNode: Element,previousProperties: VNodeProperties,properties: VNodeProperties){domNode.classList.add(classes);}};}// usagerender(){returnv('div',{classes: classes(['classOne','classTwo',this.them(themeClassOne)])});}
Another possible use-case would be to support specific bags for properties, attributes, with custom applicators:
Enhancement
The
meta
functionality has evolved from its initial concept of being a mechanism that provides access to simply get information from a DOM node to being used more generally for both reading information and also writing/adding information to DOM nodes created by the virtual DOM system.For reading information, such as
Dimensions
andIntersectionObserver
usingthis.meta
during the render lifecycle seems to provides adequate ergonomics and functionality.However, when used to "set" properties or "add" functionality to a DOM node it feels clunky to need to do this in a decoupled programmatic fashion and not declaratively when using
v()
for the required node.By adding a concept of an applicator, it will enable declaring
meta
functionality directly on the node(s) that they are needed.The VDom applicators are not limited to just metas, but will enable consumers to write other extended functionality to hook into the vdom rendering system, for example, custom application (or diffing strategy) for a specific attribute or property.
Another possible use-case would be to support specific bags for
properties
,attributes
, with custom applicators:It would be nice to be able to restrict the key used by an applicator implementation, but this could prove challenging, if possible at all.
The text was updated successfully, but these errors were encountered: