1- /*
1+ /*
22 * Copyright 2013 The Polymer Authors. All rights reserved.
33 * Use of this source code is governed by a BSD-style
44 * license that can be found in the LICENSE file.
55 */
66
77( function ( ) {
8-
8+
99var thisFile = 'platform.js' ;
1010var scopeName = 'Platform' ;
1111
12- // module dependencies
12+ function processFlags ( flags ) {
13+ if ( flags . build ) {
14+ // use the minified build
15+ this . modules = [ 'platform.min.js' ] ;
16+ } else {
17+ // truthy value for any of these flags or failure to detect native
18+ // shadowDOM results in polyfill
19+ flags . shadow = ( flags . shadowdom || flags . shadow || flags . polyfill ||
20+ ! HTMLElement . prototype . webkitCreateShadowRoot ) && 'polyfill' ;
1321
14- var ShadowDOMNative = [
15- 'src/patches-shadowdom-native.js'
16- ] ;
22+ var ShadowDOMNative = [
23+ 'src/patches-shadowdom-native.js'
24+ ] ;
1725
18- var ShadowDOMPolyfill = [
19- '../ShadowDOM/shadowdom.js' ,
20- 'src/patches-shadowdom-polyfill.js' ,
21- 'src/ShadowCSS.js'
22- ] ;
26+ var ShadowDOMPolyfill = [
27+ '../ShadowDOM/shadowdom.js' ,
28+ 'src/patches-shadowdom-polyfill.js' ,
29+ 'src/ShadowCSS.js'
30+ ] ;
2331
24- var Lib = [
25- 'src/lang.js' ,
26- 'src/dom.js' ,
27- 'src/template.js' ,
28- 'src/inspector.js' ,
29- ] ;
32+ var Lib = [
33+ 'src/lang.js' ,
34+ 'src/dom.js' ,
35+ 'src/template.js' ,
36+ 'src/inspector.js' ,
37+ ] ;
3038
31- var MDV = [
32- '../mdv/mdv.js' ,
33- 'src/patches-mdv.js'
34- ] ;
39+ var MDV = [
40+ '../mdv/mdv.js' ,
41+ 'src/patches-mdv.js'
42+ ] ;
3543
36- var Pointer = [
37- '../PointerGestures/pointergestures.js'
38- ] ;
44+ var Pointer = [
45+ '../PointerGestures/pointergestures.js'
46+ ] ;
3947
40- var WebElements = [
41- '../HTMLImports/html-imports.js' ,
42- '../CustomElements/custom-elements.js' ,
43- 'src/patches-custom-elements.js'
44- ] ;
48+ var WebElements = [
49+ '../HTMLImports/html-imports.js' ,
50+ '../CustomElements/custom-elements.js' ,
51+ 'src/patches-custom-elements.js'
52+ ] ;
4553
46- function processFlags ( flags ) {
47- flags . shadow = ( flags . shadowdom || flags . shadow || flags . polyfill ||
48- ! HTMLElement . prototype . webkitCreateShadowRoot ) && 'polyfill' ;
49- var ShadowDOM = flags . shadow ? ShadowDOMPolyfill : ShadowDOMNative ;
50- this . modules = [ ] . concat (
51- ShadowDOM ,
52- Lib ,
53- WebElements ,
54- Pointer ,
55- MDV
56- ) ;
54+ // select ShadowDOM impl
55+ var ShadowDOM = flags . shadow ? ShadowDOMPolyfill : ShadowDOMNative ;
56+
57+ // construct active dependency list
58+ this . modules = [ ] . concat (
59+ ShadowDOM ,
60+ Lib ,
61+ WebElements ,
62+ Pointer ,
63+ MDV
64+ ) ;
65+ }
5766}
5867
59- // export
68+ // export
6069
6170window [ scopeName ] = {
6271 entryPointName : thisFile ,
@@ -72,7 +81,7 @@ var basePath = src.slice(0, src.indexOf(thisFile));
7281if ( ! window . Loader ) {
7382 var path = basePath + 'tools/loader/loader.js' ;
7483 document . write ( '<script src="' + path + '"></script>' ) ;
75- }
84+ }
7685document . write ( '<script>Loader.load("' + scopeName + '")</script>' ) ;
77-
86+
7887} ) ( ) ;
0 commit comments