nanocomponent icon indicating copy to clipboard operation
nanocomponent copied to clipboard

allow createElement to return DocumentFragment?

Open ungoldman opened this issue 6 years ago • 8 comments
trafficstars

nanohtml now supports document fragments, which are very handy for returning a collection of siblings without having to wrap them in an arbitrary element.

However nanocomponent is not currently designed to handle this.

If we modify the el instanceof window.Element assert in _handleRender to also accept window.DocumentFragment, we encounter an error because nanocomponent is trying to brand the returned node (which isn't a node).

This also complicates proxying and many other things. I'm not sure how much of a rewrite this would require, but I do think it would be nice to support this feature.

Thoughts?

ungoldman avatar Apr 24 '19 22:04 ungoldman

Open to ideas. I've been brainstorming the use of weakmaps as way to avoid having to look at the DOM too.

bcomnes avatar Apr 24 '19 22:04 bcomnes

It may be easier to write a different component class to start out with. But also open to changes landing here.

bcomnes avatar Apr 24 '19 22:04 bcomnes

I've been considering a fresh start based on things I've learned the last couple years since we started the nanocomponent journey. Maybe... the time has come.

ungoldman avatar Apr 24 '19 22:04 ungoldman

https://github.com/hyperdivision/nanomorph-guard https://github.com/hyperdivision/hui

Is one such start.

bcomnes avatar Apr 24 '19 22:04 bcomnes

yep just took a look at hui earlier today

ungoldman avatar Apr 24 '19 23:04 ungoldman

A few others I've been looking at too:

https://github.com/Polymer/lit-element https://github.com/WebReflection/hyperHTML-Element https://github.com/WebReflection/wicked-elements https://github.com/WebReflection/lighterhtml#what-about-custom-elements- (Vanilla web components)

bcomnes avatar Apr 24 '19 23:04 bcomnes

I have been using lit-element for a while and it is pretty cool. Also Beaker has been rebuild using lit-element

YerkoPalma avatar Apr 24 '19 23:04 YerkoPalma

or choo-hooks ;)

s3ththompson avatar Apr 25 '19 21:04 s3ththompson