Skip to content

Commit d3f3793

Browse files
committed
Don't modify insertHTMLBefore before simple-dom
1 parent ecc3230 commit d3f3793

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/@glimmer/runtime/lib/dom/operations.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
SimpleNode,
99
SimpleText,
1010
} from '@glimmer/interfaces';
11-
import type { TrustedHTML } from 'trusted-types/lib';
1211
import { expect, INSERT_BEFORE_BEGIN, INSERT_BEFORE_END, NS_SVG } from '@glimmer/util';
1312

1413
import { ConcreteBounds } from '../bounds';
@@ -67,11 +66,7 @@ export class DOMOperations {
6766
parent.insertBefore(node, reference);
6867
}
6968

70-
insertHTMLBefore(
71-
parent: SimpleElement,
72-
nextSibling: Nullable<SimpleNode>,
73-
html: string | TrustedHTML
74-
): Bounds {
69+
insertHTMLBefore(parent: SimpleElement, nextSibling: Nullable<SimpleNode>, html: string): Bounds {
7570
if (html === '') {
7671
const comment = this.createComment('');
7772
parent.insertBefore(comment, nextSibling);
@@ -82,10 +77,10 @@ export class DOMOperations {
8277
let last: SimpleNode;
8378

8479
if (nextSibling === null) {
85-
parent.insertAdjacentHTML(INSERT_BEFORE_END, html as string);
80+
parent.insertAdjacentHTML(INSERT_BEFORE_END, html);
8681
last = expect(parent.lastChild, 'bug in insertAdjacentHTML?');
8782
} else if (nextSibling instanceof HTMLElement) {
88-
nextSibling.insertAdjacentHTML('beforebegin', html as string);
83+
nextSibling.insertAdjacentHTML('beforebegin', html);
8984
last = expect(nextSibling.previousSibling, 'bug in insertAdjacentHTML?');
9085
} else {
9186
// Non-element nodes do not support insertAdjacentHTML, so add an
@@ -96,7 +91,7 @@ export class DOMOperations {
9691
const { uselessElement } = this;
9792

9893
parent.insertBefore(uselessElement, nextSibling);
99-
uselessElement.insertAdjacentHTML(INSERT_BEFORE_BEGIN, html as string);
94+
uselessElement.insertAdjacentHTML(INSERT_BEFORE_BEGIN, html);
10095
last = expect(uselessElement.previousSibling, 'bug in insertAdjacentHTML?');
10196
parent.removeChild(uselessElement);
10297
}

0 commit comments

Comments
 (0)