Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
platform.js is now a build, old platform.js is now platform.dev.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Nov 8, 2013
1 parent c587307 commit 8b552d7
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 97 deletions.
98 changes: 98 additions & 0 deletions platform.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* 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.
*/

(function() {

var thisFile = 'platform.js';
var scopeName = 'Platform';

function processFlags(flags) {
if (flags.build) {
// use the minified build
this.modules = ['platform.min.js'];
} else {
// If any of these flags match 'native', then force native ShadowDOM; any
// other truthy value, or failure to detect native
// ShadowDOM, results in polyfill
flags.shadow = (flags.shadow || flags.shadowdom || flags.polyfill);
if (flags.shadow === 'native') {
flags.shadow = false;
} else {
flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot
&& 'polyfill';
}

var ShadowDOMNative = [
'src/patches-shadowdom-native.js'
];

var ShadowDOMPolyfill = [
'../ShadowDOM/shadowdom.js',
'src/patches-shadowdom-polyfill.js',
'src/ShadowCSS.js'
];

var Lib = [
'src/lang.js',
'src/dom.js',
'src/template.js',
'src/inspector.js'
];

var MDV = [
'../observe-js/src/observe.js',
'../NodeBind/src/NodeBind.js',
'../TemplateBinding/src/TemplateBinding.js',
'../polymer-expressions/third_party/esprima/esprima.js',
'../polymer-expressions/src/polymer-expressions.js',
'src/patches-mdv.js'
];

var Pointer = [
'../PointerGestures/pointergestures.js'
];

var WebElements = [
'../HTMLImports/html-imports.js',
'../CustomElements/custom-elements.js',
'src/patches-custom-elements.js',
'src/microtask.js'
];

// select ShadowDOM impl
var ShadowDOM = flags.shadow ? ShadowDOMPolyfill : ShadowDOMNative;

// construct active dependency list
this.modules = [].concat(
ShadowDOM,
Lib,
WebElements,
Pointer,
MDV
);
}
}

// export

window[scopeName] = {
entryPointName: thisFile,
processFlags: processFlags
};

// bootstrap

var script = document.querySelector('script[src*="' + thisFile + '"]');
var src = script.attributes.src.value;
var basePath = src.slice(0, src.indexOf(thisFile));

if (!window.PolymerLoader) {
var path = basePath + '../tools/loader/loader.js';
document.write('<script src="' + path + '"></script>');
}
document.write('<script>PolymerLoader.load("' + scopeName + '")</script>');

})();
Loading

0 comments on commit 8b552d7

Please sign in to comment.