Skip to content

Commit c3b1687

Browse files
committed
handle non-document situations w/behaviors
1 parent 0218668 commit c3b1687

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/core/runtime/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export class Runtime {
374374

375375
assignToNamespace(elt, nameSpace, name, value) {
376376
let root
377-
if (typeof document !== "undefined" && elt === document.body) {
377+
if (elt == null || (typeof document !== "undefined" && elt === document.body)) {
378378
root = this.#globalScope;
379379
} else {
380380
root = this.getHyperscriptFeatures(elt);

src/parsetree/features/behavior.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class BehaviorFeature extends Feature {
2727
const hs = this.hs;
2828

2929
runtime.assignToNamespace(
30-
runtime.globalScope.document && runtime.globalScope.document.body,
30+
null,
3131
nameSpace,
3232
name,
3333
function (target, source, innerArgs) {

0 commit comments

Comments
 (0)