From ac067652c140e723bbea4939224a5ab55a12a683 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Fri, 3 Mar 2017 16:42:11 -0800 Subject: [PATCH] * allow setting `rootPath` * disallow setting `importPath` (this is supported in 2.x but not 1.x) --- src/lib/resolve-url.html | 3 ++- src/mini/template.html | 18 +++++++++--------- test/unit/resolveurl.html | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/lib/resolve-url.html b/src/lib/resolve-url.html index 74fc5f43fc..ac90f2734a 100644 --- a/src/lib/resolve-url.html +++ b/src/lib/resolve-url.html @@ -94,7 +94,8 @@ }; // NOTE: IE11 does not support baseURI - Polymer.rootPath = pathFromUrl(document.baseURI || window.location.href); + Polymer.rootPath = Polymer.Settings.rootPath || + pathFromUrl(document.baseURI || window.location.href); })(); diff --git a/src/mini/template.html b/src/mini/template.html index ca9587e29f..06cc31cde6 100644 --- a/src/mini/template.html +++ b/src/mini/template.html @@ -31,15 +31,15 @@ module = Polymer.DomModule.import(this.is); this._template = module && module.querySelector('template'); } - if (!this._importPath) { - if (module) { - var assetPath = module.getAttribute('assetpath') || ''; - var importURL = Polymer.ResolveUrl.resolveUrl(assetPath, - module.ownerDocument.baseURI); - this._importPath = Polymer.ResolveUrl.pathFromUrl(importURL); - } else { - this._importPath = ''; - } + // NOTE: users setting `_importPath` is supported in Polymer 2.x but not + // 1.x. + if (module) { + var assetPath = module.getAttribute('assetpath') || ''; + var importURL = Polymer.ResolveUrl.resolveUrl(assetPath, + module.ownerDocument.baseURI); + this._importPath = Polymer.ResolveUrl.pathFromUrl(importURL); + } else { + this._importPath = ''; } // stick finger in footgun if (this._template && this._template.hasAttribute('is')) { diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html index b755aec9fa..416b720ef3 100644 --- a/test/unit/resolveurl.html +++ b/test/unit/resolveurl.html @@ -13,6 +13,11 @@ + @@ -34,6 +39,26 @@ + + + + + + + +