Skip to content

Commit

Permalink
Merge 57c9c8d into 486739e
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjk committed Aug 18, 2022
2 parents 486739e + 57c9c8d commit 8b9e2f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/selfish-lobsters-cheat.md
@@ -0,0 +1,6 @@
---
'lit-html': patch
'lit': patch
---

Use existing `document` in Node build
15 changes: 8 additions & 7 deletions packages/lit-html/src/lit-html.ts
Expand Up @@ -344,13 +344,14 @@ const markerMatch = '?' + marker;
// syntax because it's slightly smaller, but parses as a comment node.
const nodeMarker = `<${markerMatch}>`;

const d = NODE_MODE
? ({
createTreeWalker() {
return {};
},
} as unknown as Document)
: document;
const d =
NODE_MODE && global.document === undefined
? ({
createTreeWalker() {
return {};
},
} as unknown as Document)
: document;

// Creates a dynamic marker. We never have to search for these in the DOM.
const createMarker = (v = '') => d.createComment(v);
Expand Down

0 comments on commit 8b9e2f4

Please sign in to comment.