diff --git a/src/HTMLImports.js b/src/HTMLImports.js index 4f4791c..83d0465 100644 --- a/src/HTMLImports.js +++ b/src/HTMLImports.js @@ -8,17 +8,15 @@ */ (function(scope) { +// imports var useNative = scope.useNative; var flags = scope.flags; -var IMPORT_LINK_TYPE = 'import'; - -// TODO(sorvell): SD polyfill intrusion -var mainDoc = window.ShadowDOMPolyfill ? - ShadowDOMPolyfill.wrapIfNeeded(document) : document; +var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE; if (!useNative) { // imports + var rootDocument = scope.rootDocument; var xhr = scope.xhr; var Loader = scope.Loader; var parser = scope.parser; @@ -60,7 +58,7 @@ if (!useNative) { // find the proper set of load selectors for a given node loadSelectorsForNode: function(node) { var doc = node.ownerDocument || node; - return doc === mainDoc ? this.documentPreloadSelectors : + return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors; }, @@ -170,7 +168,7 @@ if (!useNative) { }; Object.defineProperty(document, 'baseURI', baseURIDescriptor); - Object.defineProperty(mainDoc, 'baseURI', baseURIDescriptor); + Object.defineProperty(rootDocument, 'baseURI', baseURIDescriptor); } // IE shim for CustomEvent diff --git a/src/Observer.js b/src/Observer.js index bfdd04c..69f4f66 100644 --- a/src/Observer.js +++ b/src/Observer.js @@ -8,11 +8,14 @@ */ (function(scope){ +// imports var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE; -var importSelector = 'link[rel=' + IMPORT_LINK_TYPE + ']'; var importer = scope.importer; var parser = scope.parser; +var importSelector = 'link[rel=' + IMPORT_LINK_TYPE + ']'; + + // we track mutations for addedNodes, looking for imports function handler(mutations) { for (var i=0, l=mutations.length, m; (i