Merge branch 'master' into issue51

This commit is contained in:
Jacob Rossi
2014-12-04 11:23:44 -08:00
255 changed files with 2047 additions and 1110 deletions

View File

@@ -1,7 +1,7 @@
webcomponents.js
================
A suite of polyfills supporting the HTML web components specs:
A suite of polyfills supporting the [Web Components](http://webcomponents.org) specs:
**Custom Elements**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/)).
@@ -14,7 +14,7 @@ This also folds in polyfills for `MutationObserver` and `WeakMap`.
## Releases
Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/Polymer/webcomponentsjs/releases) of this repo. There are two variants:
Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/webcomponents/webcomponentsjs/releases) of this repo. There are two variants:
`webcomponents.js` includes all of the polyfills.

View File

@@ -1,7 +1,7 @@
{
"name": "webcomponentsjs",
"main": "webcomponents.js",
"version": "0.4.2",
"version": "0.5.1-1",
"homepage": "http://webcomponents.org",
"authors": [
"The Polymer Authors"

View File

@@ -1,6 +1,6 @@
{
"name": "webcomponents.js",
"version": "0.5.1",
"version": "0.5.1-1",
"description": "webcomponents.js",
"main": "gulpfile.js",
"directories": {
@@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/Polymer/webcomponentsjs.git"
"url": "https://github.com/webcomponents/webcomponentsjs.git"
},
"author": "The Polymer Authors",
"license": {
@@ -16,7 +16,7 @@
"url": "http://polymer.github.io/LICENSE.txt"
},
"bugs": {
"url": "https://github.com/Polymer/webcomponentsjs/issues"
"url": "https://github.com/webcomponents/webcomponentsjs/issues"
},
"homepage": "http://webcomponents.org",
"devDependencies": {

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -32,7 +33,7 @@ scope.hasNative = Boolean(document.registerElement);
// NOTE: For consistent timing, use native custom elements only when not
// polyfilling other key related web components features.
scope.useNative = !flags.register && scope.hasNative &&
scope.useNative = !flags.register && scope.hasNative &&
!window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
})(CustomElements);
})(CustomElements);

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -12,6 +13,8 @@
var useNative = scope.useNative;
var initializeModules = scope.initializeModules;
var isIE = /Trident/.test(navigator.userAgent);
// If native, setup stub api and bail.
// NOTE: we fire `WebComponentsReady` under native for api compatibility
if (useNative) {
@@ -31,8 +34,8 @@ if (useNative) {
};
} else {
// Initialize polyfill modules. Note, polyfill modules are loaded but not
// executed; this is a convenient way to control which modules run when
// Initialize polyfill modules. Note, polyfill modules are loaded but not
// executed; this is a convenient way to control which modules run when
// the polyfill is required and allows the polyfill to load even when it's
// not needed.
initializeModules();
@@ -65,7 +68,7 @@ function bootstrap() {
//CustomElements.parser.parse(elt.import);
};
}
// set internal 'ready' flag, now document.registerElement will trigger
// set internal 'ready' flag, now document.registerElement will trigger
// synchronous upgrades
CustomElements.ready = true;
// async to ensure *native* custom elements upgrade prior to this
@@ -85,7 +88,8 @@ function bootstrap() {
}
// CustomEvent shim for IE
if (typeof window.CustomEvent !== 'function') {
// NOTE: we explicitly test for IE since Safari has an type `object` CustomEvent
if (isIE && (typeof window.CustomEvent !== 'function')) {
window.CustomEvent = function(inType, params) {
params = params || {};
var e = document.createEvent('CustomEvent');
@@ -105,7 +109,7 @@ if (document.readyState === 'complete' || scope.flags.eager) {
} else if (document.readyState === 'interactive' && !window.attachEvent &&
(!window.HTMLImports || window.HTMLImports.ready)) {
bootstrap();
// When loading at other readyStates, wait for the appropriate DOM event to
// When loading at other readyStates, wait for the appropriate DOM event to
// bootstrap.
} else {
var loadEvent = window.HTMLImports && !HTMLImports.ready ?

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -101,9 +102,9 @@ function attached(element) {
// multiple times so we protect against extra processing here.
function _attached(element) {
// track element for insertion if it's upgraded and cares about insertion
if (element.__upgraded__ &&
if (element.__upgraded__ &&
(element.attachedCallback || element.detachedCallback)) {
// bail if the element is already marked as attached and proceed only
// bail if the element is already marked as attached and proceed only
// if it's actually in the document at this moment.
if (!element.__attached && inDocument(element)) {
element.__attached = true;
@@ -118,7 +119,7 @@ function _attached(element) {
Manage nodes detached from document trees
*/
// manage lifecycle on detached node and it's subtree; process detached
// manage lifecycle on detached node and it's subtree; process detached
// for the node and entire subtree
function detachedNode(node) {
detached(node);
@@ -141,9 +142,9 @@ function detached(element) {
// multiple times so we protect against extra processing here.
function _detached(element) {
// track element for removal if it's upgraded and cares about removal
if (element.__upgraded__ &&
if (element.__upgraded__ &&
(element.attachedCallback || element.detachedCallback)) {
// bail if the element is already marked as not attached and proceed only
// bail if the element is already marked as not attached and proceed only
// if it's actually *not* in the document at this moment.
if (element.__attached && !inDocument(element)) {
element.__attached = false;
@@ -187,7 +188,7 @@ function watchShadow(node) {
Here's an example:
(1) In this case, recursion is required to see `child`:
(1) In this case, recursion is required to see `child`:
node.innerHTML = '<div><child></child></div>'
@@ -233,7 +234,7 @@ function handler(mutations) {
/*
When elements are added to the dom, upgrade and attached/detached may be
When elements are added to the dom, upgrade and attached/detached may be
asynchronous. `CustomElements.takeRecords` can be called to process any
pending upgrades and attached/detached callbacks synchronously.
*/
@@ -280,7 +281,7 @@ function upgradeDocument(doc) {
/*
This method is intended to be called when the document tree (including imports)
has pending custom elements to upgrade. It can be called multiple times and
has pending custom elements to upgrade. It can be called multiple times and
should do nothing if no elements are in need of upgrade.
*/
function upgradeDocumentTree(doc) {

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -66,7 +67,7 @@ function upgradeWithDefinition(element, definition) {
return element;
}
// Set __proto__ on supported platforms and use a mixin strategy when
// Set __proto__ on supported platforms and use a mixin strategy when
// this is not supported; e.g. on IE10.
function implementPrototype(element, definition) {
// prototype swizzling is best

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -14,8 +15,8 @@ var flags = scope.flags;
// This loader supports a dynamic list of urls
// and an oncomplete callback that is called when the loader is done.
// NOTE: The polyfill currently does *not* need this dynamism or the
// onComplete concept. Because of this, the loader could be simplified
// NOTE: The polyfill currently does *not* need this dynamism or the
// onComplete concept. Because of this, the loader could be simplified
// quite a bit.
var Loader = function(onLoad, onComplete) {
this.cache = {};
@@ -132,4 +133,4 @@ Loader.prototype = {
// exports
scope.Loader = Loader;
});
});

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -45,9 +46,9 @@ var currentScriptDescriptor = {
get: function() {
var script = HTMLImports.currentScript || document.currentScript ||
// NOTE: only works when called in synchronously executing code.
// readyState should check if `loading` but IE10 is
// readyState should check if `loading` but IE10 is
// interactive when scripts run so we cheat.
(document.readyState !== 'complete' ?
(document.readyState !== 'complete' ?
document.scripts[document.scripts.length - 1] : null);
return wrap(script);
},
@@ -64,16 +65,16 @@ Object.defineProperty(rootDocument, '_currentScript', currentScriptDescriptor);
code in either an `HTMLImportsLoaded` hander or after load time in an
`HTMLImports.whenReady(callback)` call.
NOTE: This module also supports these apis under the native implementation.
Therefore, if this file is loaded, the same code can be used under both
NOTE: This module also supports these apis under the native implementation.
Therefore, if this file is loaded, the same code can be used under both
the polyfill and native implementation.
*/
var isIE = /Trident|Edge/.test(navigator.userAgent);
// call a callback when all HTMLImports in the document at call time
// call a callback when all HTMLImports in the document at call time
// (or at least document ready) have loaded.
// 1. ensure the document is in a ready state (has dom), then
// 1. ensure the document is in a ready state (has dom), then
// 2. watch for loading of imports and call callback when done
function whenReady(callback, doc) {
doc = doc || rootDocument;
@@ -95,7 +96,7 @@ function isDocumentReady(doc) {
function whenDocumentReady(callback, doc) {
if (!isDocumentReady(doc)) {
var checkReady = function() {
if (doc.readyState === 'complete' ||
if (doc.readyState === 'complete' ||
doc.readyState === requiredReadyState) {
doc.removeEventListener(READY_EVENT, checkReady);
whenDocumentReady(callback, doc);
@@ -115,7 +116,7 @@ function markTargetLoaded(event) {
function watchImportsLoad(callback, doc) {
var imports = doc.querySelectorAll('link[rel=import]');
var loaded = 0, l = imports.length;
function checkDone(d) {
function checkDone(d) {
if ((loaded == l) && callback) {
callback();
}
@@ -143,15 +144,15 @@ function watchImportsLoad(callback, doc) {
// all imports (see below).
// However, we cannot rely on this entirely without watching the entire document
// for import links. For perf reasons, currently only head is watched.
// Instead, we fallback to checking if the import property is available
// and the document is not itself loading.
// Instead, we fallback to checking if the import property is available
// and the document is not itself loading.
function isImportLoaded(link) {
return useNative ? link.__loaded ||
return useNative ? link.__loaded ||
(link.import && link.import.readyState !== 'loading') :
link.__importParsed;
}
// TODO(sorvell): Workaround for
// TODO(sorvell): Workaround for
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007, should be removed when
// this bug is addressed.
// (1) Install a mutation observer to see when HTMLImports have loaded
@@ -159,7 +160,7 @@ function isImportLoaded(link) {
// imports for loading.
//
// NOTE: The workaround has restricted functionality: (1) it's only compatible
// with imports that are added to document.head since the mutation observer
// with imports that are added to document.head since the mutation observer
// watches only head for perf reasons, (2) it requires this script
// to run before any imports have completed loading.
if (useNative) {
@@ -174,7 +175,7 @@ if (useNative) {
function handleImports(nodes) {
for (var i=0, l=nodes.length, n; (i<l) && (n=nodes[i]); i++) {
if (isImport(n)) {
handleImport(n);
handleImport(n);
}
}
}
@@ -206,8 +207,8 @@ if (useNative) {
}
// Fire the 'HTMLImportsLoaded' event when imports in document at load time
// have loaded. This event is required to simulate the script blocking
// Fire the 'HTMLImportsLoaded' event when imports in document at load time
// have loaded. This event is required to simulate the script blocking
// behavior of native imports. A main document script that needs to be sure
// imports have loaded should wait for this event.
whenReady(function() {

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -9,7 +10,8 @@
(function(scope){
// imports
initializeModules = scope.initializeModules;
var initializeModules = scope.initializeModules;
var isIE = scope.isIE;
/*
NOTE: Even when native HTMLImports exists, the following api is available by
@@ -24,20 +26,20 @@ if (scope.useNative) {
return;
}
// IE shim for CustomEvent
if (typeof window.CustomEvent !== 'function') {
window.CustomEvent = function(inType, dictionary) {
var e = document.createEvent('HTMLEvents');
e.initEvent(inType,
dictionary.bubbles === false ? false : true,
dictionary.cancelable === false ? false : true,
dictionary.detail);
// CustomEvent shim for IE
// NOTE: we explicitly test for IE since Safari has an type `object` CustomEvent
if (isIE && (typeof window.CustomEvent !== 'function')) {
window.CustomEvent = function(inType, params) {
params = params || {};
var e = document.createEvent('CustomEvent');
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
return e;
};
window.CustomEvent.prototype = window.Event.prototype;
}
// Initialize polyfill modules. Note, polyfill modules are loaded but not
// executed; this is a convenient way to control which modules run when
// Initialize polyfill modules. Note, polyfill modules are loaded but not
// executed; this is a convenient way to control which modules run when
// the polyfill is required and allows the polyfill to load even when it's
// not needed.
initializeModules();
@@ -51,9 +53,9 @@ var rootDocument = scope.rootDocument;
function bootstrap() {
HTMLImports.importer.bootDocument(rootDocument);
}
// TODO(sorvell): SD polyfill does *not* generate mutations for nodes added
// by the parser. For this reason, we must wait until the dom exists to
// by the parser. For this reason, we must wait until the dom exists to
// bootstrap.
if (document.readyState === 'complete' ||
(document.readyState === 'interactive' && !window.attachEvent)) {

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -46,17 +47,17 @@ var dynamic = {
shouldParseNode: function(node) {
return (node.nodeType === 1) && matches.call(node,
parser.parseSelectorsForNode(node));
parser.parseSelectorsForNode(node));
}
};
// let the dynamic element helper tie into the import observer.
importer.observer.addCallback = dynamic.added.bind(dynamic);
// x-plat matches
var matches = HTMLElement.prototype.matches ||
HTMLElement.prototype.matchesSelector ||
var matches = HTMLElement.prototype.matches ||
HTMLElement.prototype.matchesSelector ||
HTMLElement.prototype.webkitMatchesSelector ||
HTMLElement.prototype.mozMatchesSelector ||
HTMLElement.prototype.msMatchesSelector;

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -22,43 +23,43 @@ var parser = scope.parser;
// for any document, importer:
// - loads any linked import documents (with deduping)
// - whenever an import is loaded, prompts the parser to try to parse
// - observes imported documents for new elements (these are handled via the
// - observes imported documents for new elements (these are handled via the
// dynamic importer)
var importer = {
documents: {},
// nodes to load in the mian document
documentPreloadSelectors: IMPORT_SELECTOR,
// nodes to load in imports
importsPreloadSelectors: [
IMPORT_SELECTOR
].join(','),
loadNode: function(node) {
importLoader.addNode(node);
},
// load all loadable elements within the parent element
loadSubtree: function(parent) {
var nodes = this.marshalNodes(parent);
// add these nodes to loader's queue
importLoader.addNodes(nodes);
},
marshalNodes: function(parent) {
// all preloadable nodes in inDocument
return parent.querySelectorAll(this.loadSelectorsForNode(parent));
},
// find the proper set of load selectors for a given node
loadSelectorsForNode: function(node) {
var doc = node.ownerDocument || node;
return doc === rootDocument ? this.documentPreloadSelectors :
this.importsPreloadSelectors;
},
loaded: function(url, elt, resource, err, redirectedUrl) {
flags.load && console.log('loaded', url, elt);
// store generic resource
@@ -87,7 +88,7 @@ var importer = {
}
parser.parseNext();
},
bootDocument: function(doc) {
this.loadSubtree(doc);
// observe documents for new elements being added
@@ -102,11 +103,11 @@ var importer = {
};
// loader singleton to handle loading imports
var importLoader = new Loader(importer.loaded.bind(importer),
var importLoader = new Loader(importer.loaded.bind(importer),
importer.loadedAll.bind(importer));
// observer singleton to handle observing elements in imports
// NOTE: the observer has a node added callback and this is set
// NOTE: the observer has a node added callback and this is set
// by the dynamic importer module.
importer.observer = new Observer();
@@ -128,7 +129,8 @@ function makeDocument(resource, url) {
base.setAttribute('href', url);
// add baseURI support to browsers (IE) that lack it.
if (!doc.baseURI) {
doc.baseURI = url;
// Use defineProperty since Safari throws an exception when using assignment.
Object.defineProperty(doc, 'baseURI', {value:url});
}
// ensure UTF-8 charset
var meta = doc.createElement('meta');
@@ -164,4 +166,4 @@ if (!document.baseURI) {
scope.importer = importer;
scope.importLoader = importLoader;
});
});

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -21,7 +22,7 @@ var IMPORT_SELECTOR = 'link[rel=' + IMPORT_LINK_TYPE + ']';
// parses import related elements and ensures proper parse order
// parse order is enforced by crawling the tree and monitoring which elements
// have been parsed;
// elements can be dynamically added to imports. These are maintained in a
// elements can be dynamically added to imports. These are maintained in a
// separate queue and parsed after all other elements.
var importParser = {
@@ -79,7 +80,7 @@ var importParser = {
// To prompt the system to parse the next element, parseNext should then be
// called.
// Note, parseNext used to be included at the end of markParsingComplete, but
// we must not do this so that, for example, we can (1) mark parsing complete
// we must not do this so that, for example, we can (1) mark parsing complete
// then (2) fire an import load event, and then (3) parse the next resource.
markParsing: function(elt) {
flags.parse && console.log('parsing', elt);
@@ -117,7 +118,7 @@ var importParser = {
this.markParsingComplete(elt);
// fire load event
if (elt.__resource && !elt.__error) {
elt.dispatchEvent(new CustomEvent('load', {bubbles: false}));
elt.dispatchEvent(new CustomEvent('load', {bubbles: false}));
} else {
elt.dispatchEvent(new CustomEvent('error', {bubbles: false}));
}
@@ -168,12 +169,7 @@ var importParser = {
addElementToDocument: function(elt) {
var port = this.rootImportForElement(elt.__importElement || elt);
var l = port.__insertedElements = port.__insertedElements || 0;
var refNode = port.nextElementSibling;
for (var i=0; i < l; i++) {
refNode = refNode && refNode.nextElementSibling;
}
port.parentNode.insertBefore(elt, refNode);
port.parentNode.insertBefore(elt, port);
},
// tracks when a loadable element has loaded
@@ -223,13 +219,13 @@ var importParser = {
parseScript: function(scriptElt) {
var script = document.createElement('script');
script.__importElement = scriptElt;
script.src = scriptElt.src ? scriptElt.src :
script.src = scriptElt.src ? scriptElt.src :
generateScriptDataUrl(scriptElt);
// keep track of executing script to help polyfill `document.currentScript`
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
script.parentNode.removeChild(script);
scope.currentScript = null;
scope.currentScript = null;
});
this.addElementToDocument(script);
},
@@ -240,7 +236,7 @@ var importParser = {
// order.
nextToParse: function() {
this._mayParse = [];
return !this.parsingElement && (this.nextToParseInDoc(rootDocument) ||
return !this.parsingElement && (this.nextToParseInDoc(rootDocument) ||
this.nextToParseDynamic());
},

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -11,7 +12,7 @@ HTMLImports.addModule(function(scope) {
var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
// path fixup: style elements in imports must be made relative to the main
// path fixup: style elements in imports must be made relative to the main
// document. We fixup url's in url() and @import.
var path = {
@@ -19,7 +20,7 @@ var path = {
var doc = style.ownerDocument;
var resolver = doc.createElement('a');
style.textContent = this.resolveUrlsInCssText(style.textContent, resolver);
return style;
return style;
},
resolveUrlsInCssText: function(cssText, urlObj) {
@@ -34,7 +35,7 @@ var path = {
urlObj.href = urlPath;
urlPath = urlObj.href;
return pre + '\'' + urlPath + '\'' + post;
});
});
}
};

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -48,7 +49,7 @@ xhr = {
loadDocument: function(url, next, nextContext) {
this.load(url, next, nextContext).responseType = 'document';
}
};
// exports

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2012 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(global) {

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -10,10 +11,10 @@
/*
This is a limited shim for ShadowDOM css styling.
https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
The intention here is to support only the styling features which can be
relatively simply implemented. The goal is to allow users to avoid the
most obvious pitfalls and do so without compromising performance significantly.
The intention here is to support only the styling features which can be
relatively simply implemented. The goal is to allow users to avoid the
most obvious pitfalls and do so without compromising performance significantly.
For ShadowDOM styling that's not covered here, a set of best practices
can be provided that should allow users to accomplish more complex styling.
@@ -23,56 +24,56 @@
Shimmed features:
* :host, :host-context: ShadowDOM allows styling of the shadowRoot's host
element using the :host rule. To shim this feature, the :host styles are
reformatted and prefixed with a given scope name and promoted to a
element using the :host rule. To shim this feature, the :host styles are
reformatted and prefixed with a given scope name and promoted to a
document level stylesheet.
For example, given a scope name of .foo, a rule like this:
:host {
background: red;
}
}
becomes:
.foo {
background: red;
}
* encapsultion: Styles defined within ShadowDOM, apply only to
* encapsultion: Styles defined within ShadowDOM, apply only to
dom inside the ShadowDOM. Polymer uses one of two techniques to imlement
this feature.
By default, rules are prefixed with the host element tag name
By default, rules are prefixed with the host element tag name
as a descendant selector. This ensures styling does not leak out of the 'top'
of the element's ShadowDOM. For example,
div {
font-weight: bold;
}
becomes:
x-foo div {
font-weight: bold;
}
becomes:
Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
selectors are scoped by adding an attribute selector suffix to each
simple selector that contains the host element tag name. Each element
in the element's ShadowDOM template is also given the scope attribute.
simple selector that contains the host element tag name. Each element
in the element's ShadowDOM template is also given the scope attribute.
Thus, these rules match only elements that have the scope attribute.
For example, given a scope name of x-foo, a rule like this:
div {
font-weight: bold;
}
becomes:
div[x-foo] {
font-weight: bold;
}
@@ -84,31 +85,31 @@
shadowRoot should not cross the ShadowDOM boundary and should not apply
inside a shadowRoot.
This styling behavior is not emulated. Some possible ways to do this that
This styling behavior is not emulated. Some possible ways to do this that
were rejected due to complexity and/or performance concerns include: (1) reset
every possible property for every possible selector for a given scope name;
(2) re-implement css in javascript.
As an alternative, users should make sure to use selectors
specific to the scope in which they are working.
* ::distributed: This behavior is not emulated. It's often not necessary
to style the contents of a specific insertion point and instead, descendants
of the host element can be styled selectively. Users can also create an
of the host element can be styled selectively. Users can also create an
extra node around an insertion point and style that node's contents
via descendent selectors. For example, with a shadowRoot like this:
<style>
::content(div) {
background: red;
}
</style>
<content></content>
could become:
<style>
/ *@polyfill .content-container div * /
/ *@polyfill .content-container div * /
::content(div) {
background: red;
}
@@ -116,9 +117,9 @@
<div class="content-container">
<content></content>
</div>
Note the use of @polyfill in the comment above a ShadowDOM specific style
declaration. This is a directive to the styling shim to use the selector
declaration. This is a directive to the styling shim to use the selector
in comments in lieu of the next selector when running under polyfill.
*/
(function(scope) {
@@ -232,14 +233,14 @@ var ShadowCSS = {
/*
* Process styles to convert native ShadowDOM rules that will trip
* up the css parser; we rely on decorating the stylesheet with inert rules.
*
*
* For example, we convert this rule:
*
*
* polyfill-next-selector { content: ':host menu-item'; }
* ::content menu-item {
*
*
* to this:
*
*
* scopeName menu-item {
*
**/
@@ -255,16 +256,16 @@ var ShadowCSS = {
},
/*
* Process styles to add rules which will only apply under the polyfill
*
*
* For example, we convert this rule:
*
*
* polyfill-rule {
* content: ':host menu-item';
* ...
* }
*
*
* to this:
*
*
* scopeName menu-item {...}
*
**/
@@ -280,11 +281,11 @@ var ShadowCSS = {
});
},
/* Ensure styles are scoped. Pseudo-scoping takes a rule like:
*
* .foo {... }
*
*
* .foo {... }
*
* and converts this to
*
*
* scopeName .foo { ... }
*/
scopeCssText: function(cssText, scopeSelector) {
@@ -305,15 +306,15 @@ var ShadowCSS = {
},
/*
* Process styles to add rules which will only apply under the polyfill
* and do not process via CSSOM. (CSSOM is destructive to rules on rare
* and do not process via CSSOM. (CSSOM is destructive to rules on rare
* occasions, e.g. -webkit-calc on Safari.)
* For example, we convert this rule:
*
* (comment start) @polyfill-unscoped-rule menu-item {
*
* (comment start) @polyfill-unscoped-rule menu-item {
* ... } (comment end)
*
*
* to this:
*
*
* menu-item {...}
*
**/
@@ -345,13 +346,13 @@ var ShadowCSS = {
* to
*
* scopeName.foo > .bar, .foo scopeName > .bar { }
*
*
* and
*
* :host-context(.foo:host) .bar { ... }
*
*
* to
*
*
* scopeName.foo .bar { ... }
*/
convertColonHostContext: function(cssText) {
@@ -400,7 +401,7 @@ var ShadowCSS = {
if (cssRules) {
Array.prototype.forEach.call(cssRules, function(rule) {
if (rule.selectorText && (rule.style && rule.style.cssText !== undefined)) {
cssText += this.scopeSelector(rule.selectorText, scopeSelector,
cssText += this.scopeSelector(rule.selectorText, scopeSelector,
this.strictStyling) + ' {\n\t';
cssText += this.propertiesFromRule(rule) + '\n}\n\n';
} else if (rule.type === CSSRule.MEDIA_RULE) {
@@ -440,7 +441,7 @@ var ShadowCSS = {
parts.forEach(function(p) {
p = p.trim();
if (this.selectorNeedsScoping(p, scopeSelector)) {
p = (strict && !p.match(polyfillHostNoCombinator)) ?
p = (strict && !p.match(polyfillHostNoCombinator)) ?
this.applyStrictSelectorScope(p, scopeSelector) :
this.applySelectorScope(p, scopeSelector);
}
@@ -511,7 +512,7 @@ var ShadowCSS = {
// property. (https://bugs.webkit.org/show_bug.cgi?id=118045)
// don't replace attr rules
if (rule.style.content && !rule.style.content.match(/['"]+|attr/)) {
cssText = cssText.replace(/content:[^;]*;/g, 'content: \'' +
cssText = cssText.replace(/content:[^;]*;/g, 'content: \'' +
rule.style.content + '\';');
}
// TODO(sorvell): we can workaround this issue here, but we need a list
@@ -551,7 +552,7 @@ var selectorRe = /([^{]*)({[\s\S]*?})/gim,
cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
// TODO(sorvell): remove either content or comment
cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim,
cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,
cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,
// TODO(sorvell): remove either content or comment
cssCommentRuleRe = /\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim,
cssContentRuleRe = /(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,
@@ -711,7 +712,7 @@ if (window.ShadowDOMPolyfill) {
// consider a better solution.
document.addEventListener('DOMContentLoaded', function() {
var urlResolver = scope.urlResolver;
if (window.HTMLImports && !HTMLImports.useNative) {
var SHIM_SHEET_SELECTOR = 'link[rel=stylesheet]' +
'[' + SHIM_ATTRIBUTE + ']';
@@ -724,7 +725,7 @@ if (window.ShadowDOMPolyfill) {
SHIM_SHEET_SELECTOR,
SHIM_STYLE_SELECTOR
].join(',');
var originalParseGeneric = HTMLImports.parser.parseGeneric;
HTMLImports.parser.parseGeneric = function(elt) {

View File

@@ -1,6 +1,13 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';
@@ -252,4 +259,4 @@
// exports
scope.ArraySplice = ArraySplice;
})(window.ShadowDOMPolyfill);
})(window.ShadowDOMPolyfill);

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function() {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/**
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(context) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2012 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
window.ShadowDOMPolyfill = {};

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/**
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/**
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/**
* Copyright 2012 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2012 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2014 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

View File

@@ -1,6 +1,12 @@
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function(scope) {
'use strict';

54
src/Template/Template.js Normal file
View File

@@ -0,0 +1,54 @@
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
// minimal template polyfill
if (typeof HTMLTemplateElement === 'undefined') {
(function() {
var TEMPLATE_TAG = 'template';
/**
Provides a minimal shim for the <template> element.
*/
HTMLTemplateElement = function() {};
HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
/**
The `decorate` method moves element children to the template's `content`.
NOTE: there is no support for dynamically adding elements to templates.
*/
HTMLTemplateElement.decorate = function(template) {
if (!template.content) {
template.content = template.ownerDocument.createDocumentFragment();
var child;
while (child = template.firstChild) {
template.content.appendChild(child);
}
}
};
/**
The `bootstrap` method is called automatically and "fixes" all
<template> elements in the document referenced by the `doc` argument.
*/
HTMLTemplateElement.bootstrap = function(doc) {
var templates = doc.querySelectorAll(TEMPLATE_TAG);
for (var i=0, l=templates.length, t; (i<l) && (t=templates[i]); i++) {
HTMLTemplateElement.decorate(t);
}
};
// auto-bootstrapping for main document
addEventListener('DOMContentLoaded', function() {
HTMLTemplateElement.bootstrap(document);
});
})();
}

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2012 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
if (typeof WeakMap === 'undefined') {

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -2,5 +2,6 @@
"build/boot.js",
"../HTMLImports/build.json",
"../CustomElements/build.json",
"../Template/Template.js",
"unresolved.js"
]

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -79,7 +80,7 @@
if (window.Polymer === polymerStub) {
window.Polymer = function() {
throw new Error('You tried to use polymer without loading it first. To ' +
'load polymer, <link rel="import" href="' +
'load polymer, <link rel="import" href="' +
'components/polymer/polymer.html">');
};
}

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -9,10 +10,10 @@
(function(scope) {
/**
The ShadowDOM polyfill uses a wrapping strategy on dom elements. This is
99% transparent but there are a few nodes (e.g. document) that cannot be
automatically wrapped. Therefore, rarely it's necessary to wrap nodes in
user code. Here we're choosing to make convenient globals `wrap` and
The ShadowDOM polyfill uses a wrapping strategy on dom elements. This is
99% transparent but there are a few nodes (e.g. document) that cannot be
automatically wrapped. Therefore, rarely it's necessary to wrap nodes in
user code. Here we're choosing to make convenient globals `wrap` and
`unwrap` that can be used whether or not the polyfill is in use.
*/
// convenient global

View File

@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@@ -9,22 +10,22 @@
(function(scope) {
// It's desireable to provide a default stylesheet
// It's desireable to provide a default stylesheet
// that's convenient for styling unresolved elements, but
// it's cumbersome to have to include this manually in every page.
// It would make sense to put inside some HTMLImport but
// the HTMLImports polyfill does not allow loading of stylesheets
// It would make sense to put inside some HTMLImport but
// the HTMLImports polyfill does not allow loading of stylesheets
// that block rendering. Therefore this injection is tolerated here.
//
// NOTE: position: relative fixes IE's failure to inherit opacity
// NOTE: position: relative fixes IE's failure to inherit opacity
// when a child is not statically positioned.
var style = document.createElement('style');
style.textContent = ''
+ 'body {'
+ 'transition: opacity ease-in 0.2s;'
+ 'transition: opacity ease-in 0.2s;'
+ ' } \n'
+ 'body[unresolved] {'
+ 'opacity: 0; display: block; overflow: hidden; position: relative;'
+ 'opacity: 0; display: block; overflow: hidden; position: relative;'
+ ' } \n'
;
var head = document.querySelector('head');

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>Custom Elements: attributes</title>
@@ -30,7 +30,7 @@
HTMLElement.prototype.setAttribute.call(this, name, value);
};
prototype.attributeChangedCallback = function(name, oldValue, newValue) {
this.attributeChangedOk = (name === 'squid') && (oldValue === null)
this.attributeChangedOk = (name === 'squid') && (oldValue === null)
&& (newValue === 'tentacles');
};
document.registerElement('x-foo', {prototype: prototype});

View File

@@ -0,0 +1,34 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
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
-->
<html>
<head>
<title>CustomEvent detail test</title>
<script src="../../tools/htmltest.js"></script>
<script src="../../tools/chai/chai.js"></script>
<script src="../../../src/CustomElements/CustomElements.js"></script>
</head>
<body>
<script>
addEventListener('WebComponentsReady', function() {
var eventName = 'some-event';
var eventDetail = 'some-detail';
document.body.addEventListener(eventName, function(evt) {
chai.assert.equal(evt.detail, eventDetail, 'expected CustomEvent detail');
done();
});
var evt = new CustomEvent(eventName, {detail: eventDetail});
document.body.dispatchEvent(evt);
});
</script>
</body>
</html>

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>Custom Elements: imports integration</title>
@@ -23,15 +23,15 @@
document.dispatchEvent(new CustomEvent('HTMLImportsLoaded', {bubbles: true}));
// parsing hook available
chai.assert.ok(HTMLImports.__importsParsingHook, 'imports parsing hook installed');
//
//
var doc = document.implementation.createHTMLDocument('Foo');
doc.body.innerHTML = '<x-foo></x-foo>';
var link = document.createElement('mock-link');
link.import = doc;
HTMLImports.__importsParsingHook(link);
//
//
addEventListener('WebComponentsReady', function() {
chai.assert.equal(2, elementsCreated, 'HTML hook allows main document and import document to upgrade');
chai.assert.equal(2, elementsCreated, 'HTML hook allows main document and import document to upgrade');
done();
})
}, 1);

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>Custom Elements: shadowdom integration</title>
@@ -33,17 +33,17 @@
var hostProto = Object.create(proto);
hostProto.createdCallback = function() {
proto.createdCallback.call(this);
chai.assert.equal(elementsCreated, 1, 'upgraded element');
chai.assert.equal(elementsCreated, 1, 'upgraded element');
var root = this.createShadowRoot();
// create element via innerHTML
root.innerHTML = '<x-foo></x-foo>';
CustomElements.takeRecords(root);
chai.assert.equal(elementsCreated, 2, 'upgraded element inside shadowRoot');
chai.assert.equal(elementsCreated, 2, 'upgraded element inside shadowRoot');
// now create async to test if the shadowRoot MutationObserver sees
setTimeout(function() {
root.innerHTML = '<x-foo></x-foo>';
CustomElements.takeRecords(root);
chai.assert.equal(elementsCreated, 3, 'upgraded element created async inside shadowRoot');
chai.assert.equal(elementsCreated, 3, 'upgraded element created async inside shadowRoot');
done();
}, 50);

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>Custom Elements: upgrade order</title>
@@ -27,7 +27,7 @@
}
registerTestElement('x-foo');
addEventListener('DOMContentLoaded', function() {
registerTestElement('x-bar');
});

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>Custom Elements: upgrade order</title>
@@ -37,12 +37,12 @@
registerTestElement('x-grandchild');
var order = [
'x-parent',
'x-parent',
'x-child', 'x-grandchild', 'x-grandchild',
'x-child', 'x-grandchild', 'x-grandchild',
'x-parent'
];
addEventListener('WebComponentsReady', function() {
chai.assert.equal(created.length, order.length, 'created length is correct');
chai.assert.equal(attached.length, order.length, 'attached length is correct');

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
suite('customElements', function() {
@@ -509,6 +513,7 @@ suite('customElements', function() {
htmlSuite('customElements (html)', function() {
htmlTest('../html/attributes.html');
htmlTest('../html/customevent-detail.html');
htmlTest('../html/upgrade-order.html');
htmlTest('../html/upgrade-dcl.html');
htmlTest('../html/imports.html');

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
// defer start of tests until after WebComponentsReady event

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
suite('observe', function() {
@@ -16,7 +20,7 @@ suite('observe', function() {
teardown(function() {
document.body.removeChild(work);
});
function registerTestComponent(inName, inValue) {
var proto = Object.create(HTMLElement.prototype);
proto.value = inValue || 'value';
@@ -24,7 +28,7 @@ suite('observe', function() {
prototype: proto
});
}
function testElements(node, selector, value) {
Array.prototype.forEach.call(node.querySelectorAll(selector), function(n) {
assert.equal(n.value, value);

View File

@@ -1,7 +1,11 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
suite('upgradeElements', function() {
@@ -16,7 +20,7 @@ suite('upgradeElements', function() {
teardown(function() {
document.body.removeChild(work);
});
function registerTestComponent(inName, inValue) {
var proto = Object.create(HTMLElement.prototype);
proto.value = inValue || 'value';
@@ -24,7 +28,7 @@ suite('upgradeElements', function() {
prototype: proto
});
}
test('CustomElements.upgrade upgrades custom element syntax', function() {
registerTestComponent('x-foo31', 'foo');
work.innerHTML = '<x-foo31>Foo</x-foo31>';
@@ -41,14 +45,14 @@ suite('upgradeElements', function() {
assert.equal(xfoo.value, 'foo');
done();
});
test('document.register upgrades custom element syntax', function() {
work.innerHTML = '<x-foo33>Foo</x-foo33>';
registerTestComponent('x-foo33', 'foo');
var xfoo = work.firstChild;
assert.equal(xfoo.value, 'foo');
});
test('CustomElements.upgrade upgrades custom element syntax', function() {
registerTestComponent('x-zot', 'zot');
registerTestComponent('x-zim', 'zim');
@@ -58,7 +62,7 @@ suite('upgradeElements', function() {
assert.equal(xzot.value, 'zot');
assert.equal(xzim.value, 'zim');
});
test('CustomElements.upgrade upgrades native extendor', function() {
var XButtonProto = Object.create(HTMLButtonElement.prototype);
XButtonProto.test = 'xbutton';
@@ -66,14 +70,14 @@ suite('upgradeElements', function() {
extends: 'button',
prototype: XButtonProto
});
work.innerHTML = '<button is="x-button"></button>';
var xbutton = work.firstChild;
CustomElements.upgradeAll(xbutton);
assert.equal(xbutton.test, 'xbutton');
});
test('CustomElements.upgrade upgrades extendor of native extendor', function() {
var XInputProto = Object.create(HTMLInputElement.prototype);
XInputProto.xInput = 'xInput';
@@ -93,8 +97,8 @@ suite('upgradeElements', function() {
assert.equal(x.xInput, 'xInput');
assert.equal(x.xSpecialInput, 'xSpecialInput');
});
test('CustomElements.upgrade upgrades native extendor', function() {
var YButtonProto = Object.create(HTMLButtonElement.prototype);
YButtonProto.test = 'ybutton';
@@ -102,7 +106,7 @@ suite('upgradeElements', function() {
extends: 'button',
prototype: YButtonProto
});
work.innerHTML = '<button is="y-button">0</button>' +
'<div><button is="y-button">1</button></div>' +
'<div><div><button is="y-button">2</button></div></div>';
@@ -114,4 +118,4 @@ suite('upgradeElements', function() {
});
});
});
});

View File

@@ -1,8 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
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
-->
<title>CustomElements Tests</title>
<meta charset="utf-8">

View File

@@ -1,15 +1,19 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* 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
*/
(function() {
var file = 'tests.js';
var base;
var src =
var src =
document.querySelector('script[src*="' + file + '"]').getAttribute('src');
var base = src.slice(0, src.indexOf(file));
@@ -25,4 +29,4 @@
document.write('<script src="' + base + 'js/' + src + '"></script>');
});
})();
})();

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>HTML Imports Test</title>

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>HTMLImportsLoaded, native</title>

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>base load test</title>

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,14 +8,13 @@
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
-->
<!doctype html>
<html>
<head>
<title>parser Test</title>
<script src="../../tools/htmltest.js"></script>
<script src="../../tools/chai/chai.js"></script>
<script src="../../../src/HTMLImports/HTMLImports.js"></script>
<meta http-equiv='Content-Security-Policy' content="script-src 'self';">
<link rel="import" href="imports/csp-import-1.html">
</head>

View File

@@ -1,4 +1,4 @@
/*
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
@@ -12,4 +12,4 @@ addEventListener('HTMLImportsLoaded', function() {
chai.assert.ok(window.externalScriptParsed1, 'externalScriptParsed1');
chai.assert.ok(window.externalScriptParsed2, 'externalScriptParsed2');
done();
});
});

View File

@@ -1,3 +1,4 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -7,7 +8,6 @@
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
-->
<!doctype html>
<html>
<head>
<title>_currentScript Test</title>

View File

@@ -0,0 +1,34 @@
<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
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
-->
<html>
<head>
<title>CustomEvent detail test</title>
<script src="../../tools/htmltest.js"></script>
<script src="../../tools/chai/chai.js"></script>
<script src="../../../src/HTMLImports/HTMLImports.js"></script>
</head>
<body>
<script>
addEventListener('HTMLImportsLoaded', function() {
var eventName = 'some-event';
var eventDetail = 'some-detail';
document.body.addEventListener(eventName, function(evt) {
chai.assert.equal(evt.detail, eventDetail, 'expected CustomEvent detail');
done();
});
var evt = new CustomEvent(eventName, {detail: eventDetail});
document.body.dispatchEvent(evt);
});
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More