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
Currently the library won't allow you to insert before/after if the reference node not found in the parent element's node list, including undefined ones. I want to insert a node after a node found by some criteria, like tag name, and if none found, insert before/after first/last child, and if there are no nodes at all, insert it as first child. First two can be easily done with one-liner like $parent.insertAfter($node,$parent.elements(:TAG<item>).tail // $parent.lastChild()), but to fulfill the last you have to check for child nodes and call a whole different method, like insert to actually insert a node, complicating the code quite a bit.
The text was updated successfully, but these errors were encountered:
Currently the library won't allow you to insert before/after if the reference node not found in the parent element's node list, including undefined ones. I want to insert a node after a node found by some criteria, like tag name, and if none found, insert before/after first/last child, and if there are no nodes at all, insert it as first child. First two can be easily done with one-liner like
$parent.insertAfter($node,$parent.elements(:TAG<item>).tail // $parent.lastChild())
, but to fulfill the last you have to check for child nodes and call a whole different method, likeinsert
to actually insert a node, complicating the code quite a bit.The text was updated successfully, but these errors were encountered: