1
- /*
1
+ /*
2
2
* Copyright 2013 The Polymer Authors. All rights reserved.
3
3
* Use of this source code is governed by a BSD-style
4
4
* license that can be found in the LICENSE file.
5
5
*/
6
6
7
7
( function ( ) {
8
-
8
+
9
9
var thisFile = 'platform.js' ;
10
10
var scopeName = 'Platform' ;
11
11
12
12
function processFlags ( flags ) {
13
- this . modules = [ flags . debug ? 'platform.debug.js' : 'platform.min.js' ] ;
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' ;
21
+
22
+ var ShadowDOMNative = [
23
+ 'src/patches-shadowdom-native.js'
24
+ ] ;
25
+
26
+ var ShadowDOMPolyfill = [
27
+ '../ShadowDOM/shadowdom.js' ,
28
+ 'src/patches-shadowdom-polyfill.js' ,
29
+ 'src/ShadowCSS.js'
30
+ ] ;
31
+
32
+ var Lib = [
33
+ 'src/lang.js' ,
34
+ 'src/dom.js' ,
35
+ 'src/template.js' ,
36
+ 'src/inspector.js' ,
37
+ ] ;
38
+
39
+ var MDV = [
40
+ '../mdv/mdv.js' ,
41
+ 'src/patches-mdv.js'
42
+ ] ;
43
+
44
+ var Pointer = [
45
+ '../PointerGestures/pointergestures.js'
46
+ ] ;
47
+
48
+ var WebElements = [
49
+ '../HTMLImports/html-imports.js' ,
50
+ '../CustomElements/custom-elements.js' ,
51
+ 'src/patches-custom-elements.js'
52
+ ] ;
53
+
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
+ }
14
66
}
15
67
16
- // export
68
+ // export
17
69
18
70
window [ scopeName ] = {
19
71
entryPointName : thisFile ,
@@ -29,7 +81,7 @@ var basePath = src.slice(0, src.indexOf(thisFile));
29
81
if ( ! window . Loader ) {
30
82
var path = basePath + 'tools/loader/loader.js' ;
31
83
document . write ( '<script src="' + path + '"></script>' ) ;
32
- }
84
+ }
33
85
document . write ( '<script>Loader.load("' + scopeName + '")</script>' ) ;
34
-
86
+
35
87
} ) ( ) ;
0 commit comments