diff options
author | Norbert Preining <norbert@preining.info> | 2021-09-15 03:01:59 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-09-15 03:01:59 +0000 |
commit | 3c36091e77e72aa582c29594048a092b63eae83c (patch) | |
tree | d26c30b3c7aed52f2ce9df0fc80a94899d6d34e3 /macros/luatex/generic/luaxml/luaxml-domobject.lua | |
parent | 1666f2f182d9f9fb45ef8aa275b477d3264ef1cb (diff) |
CTAN sync 202109150301
Diffstat (limited to 'macros/luatex/generic/luaxml/luaxml-domobject.lua')
-rw-r--r-- | macros/luatex/generic/luaxml/luaxml-domobject.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/macros/luatex/generic/luaxml/luaxml-domobject.lua b/macros/luatex/generic/luaxml/luaxml-domobject.lua index 7829c13b1e..a5c0d29fee 100644 --- a/macros/luatex/generic/luaxml/luaxml-domobject.lua +++ b/macros/luatex/generic/luaxml/luaxml-domobject.lua @@ -392,6 +392,17 @@ local parse = function( return false, msg end + -- restore correct links to parent elements + local function fix_parents(el) + for k,v in ipairs(el._children or {}) do + if v:is_element() then + v._parent = el + fix_parents(v) + end + end + end + + --- Add child node to the current node function DOM_Object:add_child_node( child, --- element to be inserted as a current node child @@ -399,6 +410,7 @@ local parse = function( ) local parent = self child._parent = parent + fix_parents(child) if position then table.insert(parent._children, position, child) else |