Files
webcomponentsjs/src/CustomElements/CustomElements.js
2015-05-13 12:32:23 -07:00

55 lines
1.5 KiB
JavaScript

/**
* @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() {
// Establish polyfill scope. We do this here to store flags. Flags are not
// supported in the build.
window.CustomElements = window.CustomElements || {flags:{}};
// Flags. Convert url arguments to flags
var flags = {};
if (!flags.noOpts) {
location.search.slice(1).split('&').forEach(function(option) {
var parts = option.split('=');
var match;
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
flags[match[1]] = parts[1] || true;
}
});
}
// Load.
var file = 'CustomElements.js';
var modules = [
'../WeakMap/WeakMap.js',
'../MutationObserver/MutationObserver.js',
'base.js',
'traverse.js',
'observe.js',
'upgrade.js',
'register.js',
'boot.js'
];
var src =
document.querySelector('script[src*="' + file + '"]').getAttribute('src');
var basePath = src.slice(0, src.indexOf(file));
modules.forEach(function(f) {
document.write('<script src="' + basePath + f + '"></script>');
});
// exports
CustomElements.flags = flags;
})();