Index: third_party/polymer/components/polymer/polymer-mini.html |
diff --git a/third_party/polymer/components/polymer/polymer-mini.html b/third_party/polymer/components/polymer/polymer-mini.html |
index d711ed09c2471643262a957adc6a3d80ee768308..ac250d7218a26d1cecd6392f80f55a88ed1768ff 100644 |
--- a/third_party/polymer/components/polymer/polymer-mini.html |
+++ b/third_party/polymer/components/polymer/polymer-mini.html |
@@ -6,10 +6,83 @@ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt |
Code distributed by Google as part of the polymer project is also |
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt |
---><link rel="import" href="polymer-micro.html"><script>Polymer.Base._addFeature({ |
+--><link rel="import" href="polymer-micro.html"><script>(function () { |
+function resolveCss(cssText, ownerDocument) { |
+return cssText.replace(CSS_URL_RX, function (m, pre, url, post) { |
+return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + post; |
+}); |
+} |
+function resolveAttrs(element, ownerDocument) { |
+for (var name in URL_ATTRS) { |
+var a$ = URL_ATTRS[name]; |
+for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) { |
+if (name === '*' || element.localName === name) { |
+at = element.attributes[a]; |
+v = at && at.value; |
+if (v && v.search(BINDING_RX) < 0) { |
+at.value = a === 'style' ? resolveCss(v, ownerDocument) : resolve(v, ownerDocument); |
+} |
+} |
+} |
+} |
+} |
+function resolve(url, ownerDocument) { |
+if (url && ABS_URL.test(url)) { |
+return url; |
+} |
+var resolver = getUrlResolver(ownerDocument); |
+resolver.href = url; |
+return resolver.href || url; |
+} |
+var tempDoc; |
+var tempDocBase; |
+function resolveUrl(url, baseUri) { |
+if (!tempDoc) { |
+tempDoc = document.implementation.createHTMLDocument('temp'); |
+tempDocBase = tempDoc.createElement('base'); |
+tempDoc.head.appendChild(tempDocBase); |
+} |
+tempDocBase.href = baseUri; |
+return resolve(url, tempDoc); |
+} |
+function getUrlResolver(ownerDocument) { |
+return ownerDocument.body.__urlResolver || (ownerDocument.body.__urlResolver = ownerDocument.createElement('a')); |
+} |
+function pathFromUrl(url) { |
+return url.substring(0, url.lastIndexOf('/') + 1); |
+} |
+var CSS_URL_RX = /(url\()([^)]*)(\))/g; |
+var URL_ATTRS = { |
+'*': [ |
+'href', |
+'src', |
+'style', |
+'url' |
+], |
+form: ['action'] |
+}; |
+var ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/; |
+var BINDING_RX = /\{\{|\[\[/; |
+Polymer.ResolveUrl = { |
+resolveCss: resolveCss, |
+resolveAttrs: resolveAttrs, |
+resolveUrl: resolveUrl, |
+pathFromUrl: pathFromUrl |
+}; |
+Polymer.rootPath = Polymer.Settings.rootPath || pathFromUrl(document.baseURI || window.location.href); |
+}());Polymer.Base._addFeature({ |
_prepTemplate: function () { |
+var module; |
if (this._template === undefined) { |
-this._template = Polymer.DomModule.import(this.is, 'template'); |
+module = Polymer.DomModule.import(this.is); |
+this._template = module && module.querySelector('template'); |
+} |
+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 = ''; |
} |
if (this._template && this._template.hasAttribute('is')) { |
this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.')); |
@@ -29,6 +102,7 @@ return dom; |
} |
});(function () { |
var baseAttachedCallback = Polymer.Base.attachedCallback; |
+var baseDetachedCallback = Polymer.Base.detachedCallback; |
Polymer.Base._addFeature({ |
_hostStack: [], |
ready: function () { |
@@ -109,6 +183,13 @@ baseAttachedCallback.call(this); |
} else { |
this._attachedPending = true; |
} |
+}, |
+detachedCallback: function () { |
+if (this._readied) { |
+baseDetachedCallback.call(this); |
+} else { |
+this._attachedPending = false; |
+} |
} |
}); |
}());Polymer.ArraySplice = function () { |