Skip to content

Commit

Permalink
fix(runtime): ensure Node is defined (#6061)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Dec 6, 2024
1 parent d362700 commit 1f5a13f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/dom-extras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const patchSlotInsertAdjacentElement = (HostElementPrototype: HTMLElement
* @param hostElementPrototype the `Element` to be patched
*/
export const patchTextContent = (hostElementPrototype: HTMLElement): void => {
let descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
let descriptor = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');

if (!descriptor) {
// for mock-doc
Expand Down Expand Up @@ -282,7 +282,7 @@ export const patchChildSlotNodes = (elm: HTMLElement) => {
}
}

let childNodesFn = Object.getOwnPropertyDescriptor(Node.prototype, 'childNodes');
let childNodesFn = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, 'childNodes');
if (!childNodesFn) {
// for mock-doc
childNodesFn = Object.getOwnPropertyDescriptor(elm, 'childNodes');
Expand Down

0 comments on commit 1f5a13f

Please sign in to comment.