1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2015-08-03 20:09:54 -04:00
parent 231cb007b1
commit 0b450116a5
22 changed files with 141 additions and 108 deletions

View file

@ -7,7 +7,7 @@
* 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
*/
// @version 0.7.7
// @version 0.7.8
window.WebComponents = window.WebComponents || {};
(function(scope) {
@ -1260,12 +1260,12 @@ window.HTMLImports.addModule(function(scope) {
var path = scope.path;
var rootDocument = scope.rootDocument;
var flags = scope.flags;
var isIE = scope.isIE;
var isIE11OrOlder = scope.isIE11OrOlder;
var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
var importParser = {
documentSelectors: IMPORT_SELECTOR,
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
map: {
link: "parseLink",
script: "parseScript",
@ -1316,6 +1316,7 @@ window.HTMLImports.addModule(function(scope) {
}
},
parseImport: function(elt) {
elt.import = elt.__doc;
if (window.HTMLImports.__importsParsingHook) {
window.HTMLImports.__importsParsingHook(elt);
}
@ -1378,6 +1379,8 @@ window.HTMLImports.addModule(function(scope) {
trackElement: function(elt, callback) {
var self = this;
var done = function(e) {
elt.removeEventListener("load", done);
elt.removeEventListener("error", done);
if (callback) {
callback(e);
}
@ -1386,7 +1389,7 @@ window.HTMLImports.addModule(function(scope) {
};
elt.addEventListener("load", done);
elt.addEventListener("error", done);
if (isIE && elt.localName === "style") {
if (isIE11OrOlder && elt.localName === "style") {
var fakeLoad = false;
if (elt.textContent.indexOf("@import") == -1) {
fakeLoad = true;
@ -1433,7 +1436,7 @@ window.HTMLImports.addModule(function(scope) {
for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
if (!this.isParsed(n)) {
if (this.hasResource(n)) {
return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
} else {
return;
}
@ -1456,7 +1459,7 @@ window.HTMLImports.addModule(function(scope) {
return this.dynamicElements.indexOf(elt) >= 0;
},
hasResource: function(node) {
if (nodeIsImport(node) && node.import === undefined) {
if (nodeIsImport(node) && node.__doc === undefined) {
return false;
}
return true;
@ -1530,7 +1533,7 @@ window.HTMLImports.addModule(function(scope) {
}
this.documents[url] = doc;
}
elt.import = doc;
elt.__doc = doc;
}
parser.parseNext();
},
@ -1912,6 +1915,7 @@ window.CustomElements.addModule(function(scope) {
}
scope.watchShadow = watchShadow;
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeDocument = upgradeDocument;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attached = attached;
@ -1923,11 +1927,9 @@ window.CustomElements.addModule(function(scope) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
if (is && definition.tag == node.localName || !is && !definition.extends) {
return upgradeWithDefinition(node, definition, isAttached);
}
}
@ -2221,6 +2223,7 @@ window.CustomElements.addModule(function(scope) {
initializeModules();
}
var upgradeDocumentTree = scope.upgradeDocumentTree;
var upgradeDocument = scope.upgradeDocument;
if (!window.wrap) {
if (window.ShadowDOMPolyfill) {
window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded;
@ -2231,13 +2234,15 @@ window.CustomElements.addModule(function(scope) {
};
}
}
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
if (elt.import) {
upgradeDocument(wrap(elt.import));
}
};
}
function bootstrap() {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;
setTimeout(function() {
window.CustomElements.readyTime = Date.now();
@ -2279,6 +2284,7 @@ window.CustomElements.addModule(function(scope) {
if (typeof HTMLTemplateElement === "undefined") {
(function() {
var TEMPLATE_TAG = "template";
var contentDoc = document.implementation.createHTMLDocument("template");
HTMLTemplateElement = function() {};
HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
HTMLTemplateElement.decorate = function(template) {
@ -2289,6 +2295,25 @@ if (typeof HTMLTemplateElement === "undefined") {
while (child = template.firstChild) {
template.content.appendChild(child);
}
Object.defineProperty(template, "innerHTML", {
get: function() {
var o = "";
for (var e = this.content.firstChild; e; e = e.nextSibling) {
o += e.outerHTML || escapeData(e.data);
}
return o;
},
set: function(text) {
contentDoc.body.innerHTML = text;
while (this.content.firstChild) {
this.content.removeChild(this.content.firstChild);
}
while (contentDoc.body.firstChild) {
this.content.appendChild(contentDoc.body.firstChild);
}
},
configurable: true
});
};
HTMLTemplateElement.bootstrap = function(doc) {
var templates = doc.querySelectorAll(TEMPLATE_TAG);
@ -2308,6 +2333,25 @@ if (typeof HTMLTemplateElement === "undefined") {
}
return el;
};
var escapeDataRegExp = /[&\u00A0<>]/g;
function escapeReplace(c) {
switch (c) {
case "&":
return "&amp;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case " ":
return "&nbsp;";
}
}
function escapeData(s) {
return s.replace(escapeDataRegExp, escapeReplace);
}
})();
}