[x3d-public] removeNamedNode removes DEF children?

Andreas Plesch andreasplesch at gmail.com
Mon Jul 11 14:10:06 PDT 2022


This applies to how removing a DOM node with x3dom should behave. From an
X3D point of view it probably should behave like group.removeChildren,
which x3dom does. That means removing a DOM DEF node does not have an
effect on a USE node.

But from a DOM programming perspective this may be surprising since the USE
instance now seems to refer to a null value.

I think improving documentation may be all what is needed.

Thanks again, Andreas

---on the phone---

On Mon, Jul 11, 2022, 2:08 PM Patrick Dähne <pdaehne at gmail.com> wrote:

>
>
> > Am 11.07.2022 um 19:27 schrieb Andreas Plesch <andreasplesch at gmail.com>:
> >
> > On Mon, Jul 11, 2022, 12:34 PM Patrick Dähne <pdaehne at gmail.com> wrote:
> > > Thanks, very helpful. After the DEF name is removed, do the USE nodes
> still rrefer to the now nameless node ?
> >
> > Yes. The scene graph does not care about DEF and USE, it is only needed
> to serialize the scene graph into a textual representation.
> >
> > Ok.
> >
> >
> >
> > > Also, is there then a way to remove a node from the scene graph ?
> >
> > Yes, send events to fields (usually Group.children or
> Group.removeChildren).
> >
> > Presumably, outer.removeChildren(inner) would then just remove the child
> (DEF) node. The USE node would still refer to the (original) DEF node ?
>
> Yes.
>
>
> > Is there a way to remove all instances of a named node at once ?
>
> No.
>
>
> Bye,
>
> Patrick
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220711/f19b7abb/attachment.html>


More information about the x3d-public mailing list