Provides the possibility to handle a just imported node. The node is
neither attached to DOM, nor children are available.
Implementation Notes:
Just exchanging one node with another of a similar (high-level)
type is considered harmless. Thus, if an element becomes an
element, this is in general safe despite possible implications
towards a document valid by schema. Such invalid states may be
fixed in later processing, though.
In general, it is not recommended to exchange a ParentNode with
some node that may not hold any children at this stage, as children
will not be handled at all. Better do so in later processing.
You may expand a given node to a set of nodes by returning
a DocumentFragment instead. Note, though, that in this stage
subsequent child nodes will be appended to this DocumentFragment
which may be unexpected. In general, such expansion should be done
at a later stage.
To ignore this node, but still process the children, you may return
an empty DocumentFragment instead.
To skip all further processing of this node (and not child nodes, as they
have not been handled yet), you may signal this by providing the skip
signal.
If you want to replace, for example, an element by just some
character data, it is recommended to do this in later processing
when the children have been processed. Otherwise, ensure
you understand possible implications of doing this in this early stage,
such as that children not being converted to CharacterData are
ignored, and that CharacterData are just appended without taking
the actual type of data into account.
When transforming from HTML to XML, you may experience a rather
limited API for importedNode compared to the original node.
Like in XML, there is no HTMLElement.dataset. Dealing with this
richer API is best done in the setup phase by overriding
prepareForImport. Here you may modify the DOM with some restrictions
to ease further processing.
Provides the possibility to handle a just imported node. The node is neither attached to DOM, nor children are available.
Implementation Notes:
Just exchanging one node with another of a similar (high-level) type is considered harmless. Thus, if an element becomes an element, this is in general safe despite possible implications towards a document valid by schema. Such invalid states may be fixed in later processing, though.
In general, it is not recommended to exchange a
ParentNodewith some node that may not hold any children at this stage, as children will not be handled at all. Better do so in later processing.You may expand a given node to a set of nodes by returning a
DocumentFragmentinstead. Note, though, that in this stage subsequent child nodes will be appended to thisDocumentFragmentwhich may be unexpected. In general, such expansion should be done at a later stage.To ignore this node, but still process the children, you may return an empty
DocumentFragmentinstead.To skip all further processing of this node (and not child nodes, as they have not been handled yet), you may signal this by providing the
skipsignal.If you want to replace, for example, an element by just some character data, it is recommended to do this in later processing when the children have been processed. Otherwise, ensure you understand possible implications of doing this in this early stage, such as that children not being converted to CharacterData are ignored, and that CharacterData are just appended without taking the actual type of data into account.
When transforming from HTML to XML, you may experience a rather limited API for
importedNodecompared to the original node. Like in XML, there is noHTMLElement.dataset. Dealing with this richer API is best done in the setup phase by overridingprepareForImport. Here you may modify the DOM with some restrictions to ease further processing.