From a007bcdfea8d22b2291cf62781ebe959445ea5a1 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Wed, 1 Oct 2014 09:05:05 -0700 Subject: [PATCH] Wrap the document, and handle null --- src/Observer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Observer.js b/src/Observer.js index 232354a..e8cbf28 100644 --- a/src/Observer.js +++ b/src/Observer.js @@ -293,7 +293,7 @@ function handler(mutations) { function takeRecords(node) { // If the optional node is not supplied, assume we mean the whole document. - if (node === undefined) node = document; + if (!node) node = wrapIfNeeded(document); // Find the root of the tree, which will be an Document or ShadowRoot. while (node.parentNode) {