Skip to content

Commit

Permalink
This seems to fix nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoxela committed Jul 17, 2024
1 parent 98370d4 commit 35bd108
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions js/plugins/backdropimage/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,24 +188,17 @@
dummy.append(document.createElement(node.name));
}
}
else if (children.length === 1) {
let element = document.createElement(node.name);
if (node.firstChild.value) {
element.append(document.createTextNode(node.firstChild.value));
}
else {
let parent = document.createElement(node.name);
if (node.attributes.length) {
for (const attr of node.attributes) {
if (!attr.name.startsWith('data-mce')) {
element.setAttribute(attr.name, attr.value);
parent.setAttribute(attr.name, attr.value);
}
}
}
dummy.append(element);
}
else {
let parent = document.createElement(node.name);
let lastChild = node.lastChild;
while (node = node.walk()) {// jshint ignore:line
while ((node = node.walk())) {
// Caution, walk() does not only walk over this node, so we have to
// stop ourselves.
if (node.name === '#text') {
Expand Down

0 comments on commit 35bd108

Please sign in to comment.