Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit c24c59c

Browse files
stephanmaxSchalk Neethling
authored andcommitted
Issue #1013 <style> elements in HTML editor break editor's render method (#1017)
**Problem:** Calling `removeChild` on a non-child node throws an error. **Fix:** The cheap solution here is to delete the content coming from the HTML editor first, then query all remaining `<style>` elements (coming from CSS editor and output base styles) and remove them from shadow root.
1 parent e1adf0d commit c24c59c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

js/editor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@
6666
if (typeof ShadyDOM !== 'undefined' && ShadyDOM.inUse) {
6767
shadow.innerHTML = '';
6868
} else {
69+
shadow.removeChild(shadow.querySelector('div'));
6970
var styleElements = shadow.querySelectorAll('style');
7071

7172
for (var styleElement in styleElements) {
7273
if (styleElements.hasOwnProperty(styleElement)) {
7374
shadow.removeChild(styleElements[styleElement]);
7475
}
7576
}
76-
77-
shadow.removeChild(shadow.querySelector('div'));
7877
}
7978
}
8079

0 commit comments

Comments
 (0)