[x3d-public] HTML Imports and ShadowDOM experiments

Andreas Plesch andreasplesch at gmail.com
Fri Jul 21 07:24:49 PDT 2017


https://glitch.com/edit/#!/juniper-wool?path=index.html:40:7

is an investigation of how HTML Imports and ShadowDOM may be used to
substitute for X3D Inline nodes. HTML Imports makes it straightforward to
load an external fragment of HTML into a document:
https://www.webcomponents.org/community/articles/introduction-to-html-imports.
And
the stated purpose of ShadowDOM is encapsulation.

Here are some observations:

HTML imports work as intended with x3dom.
It is likely one could use a generic 'include' webcomponent.
DEF nodes in the imported x3d are exported/imported, so they can be USEd.
There is no separate namescope.
HTML imports can also be attached as shadow tree to a host node. But x3dom
does not recognize the shadow tree and it is not rendered. Native X3D in
HTML or an improved x3dom would likely render those.
Attached shadow tree content cannot be selected/found with regular DOM
methods. However, shadow trees still can be selected with the
host.shadowroot property.

It is likely that one could use en existing webcomponent such as
https://www.webcomponents.org/element/github/include-fragment-element
for inline purposes as well.

Overall, it looks like that Inline would duplicate native webcomponent
capability.

It could also be fruitful to investigate how custom elements with templates
compare with protos in detail. There seems to be match in purpose and
ability.

-Andreas



--
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170721/05061ca7/attachment.html>


More information about the x3d-public mailing list