tao_on_rails 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,96 +1,108 @@
1
+ # /**
2
+ # * @license
3
+ # * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
4
+ # * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ # * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ # * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ # * Code distributed by Google as part of the polymer project is also
8
+ # * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ # */
1
10
 
2
- if window.customElements && !customElements.polyfilled
11
+ if window.customElements
3
12
  eval '''
4
- (() => {
5
- 'use strict';
6
-
7
- const NativeHTMLElement = window.HTMLElement;
8
- const nativeDefine = window.customElements.define;
9
- const nativeGet = window.customElements.get;
10
-
11
- /**
12
- * Map of user-provided constructors to tag names.
13
- *
14
- * @type {Map<Function, string>}
15
- */
16
- const tagnameByConstructor = new Map();
17
-
18
- /**
19
- * Map of tag names to user-provided constructors.
20
- *
21
- * @type {Map<string, Function>}
22
- */
23
- const constructorByTagname = new Map();
24
-
25
-
26
- /**
27
- * Whether the constructors are being called by a browser process, ie parsing
28
- * or createElement.
29
- */
30
- let browserConstruction = false;
31
-
32
- /**
33
- * Whether the constructors are being called by a user-space process, ie
34
- * calling an element constructor.
35
- */
36
- let userConstruction = false;
37
-
38
- window.HTMLElement = function() {
39
- if (!browserConstruction) {
40
- const tagname = tagnameByConstructor.get(this.constructor);
41
- const fakeClass = nativeGet.call(window.customElements, tagname);
42
-
43
- // Make sure that the fake constructor doesn't call back to this constructor
44
- userConstruction = true;
45
- const instance = new (fakeClass)();
46
- return instance;
47
- }
48
- // Else do nothing. This will be reached by ES5-style classes doing
49
- // HTMLElement.call() during initialization
50
- browserConstruction = false;
51
- };
52
- // By setting the patched HTMLElement's prototype property to the native
53
- // HTMLElement's prototype we make sure that:
54
- // document.createElement('a') instanceof HTMLElement
55
- // works because instanceof uses HTMLElement.prototype, which is on the
56
- // ptototype chain of built-in elements.
57
- window.HTMLElement.prototype = NativeHTMLElement.prototype;
58
-
59
- window.customElements.define = (tagname, elementClass) => {
60
- const elementProto = elementClass.prototype;
61
- const StandInElement = class extends NativeHTMLElement {
62
- constructor() {
63
- // Call the native HTMLElement constructor, this gives us the
64
- // under-construction instance as `this`:
65
- super();
66
-
67
- // The prototype will be wrong up because the browser used our fake
68
- // class, so fix it:
69
- Object.setPrototypeOf(this, elementProto);
70
-
71
- if (!userConstruction) {
72
- // Make sure that user-defined constructor bottom's out to a do-nothing
73
- // HTMLElement() call
74
- browserConstruction = true;
75
- // Call the user-defined constructor on our instance:
76
- elementClass.call(this);
77
- }
78
- userConstruction = false;
13
+ (() => {
14
+ 'use strict';
15
+
16
+ // Do nothing if `customElements` does not exist.
17
+ if (!window.customElements) return;
18
+
19
+ const NativeHTMLElement = window.HTMLElement;
20
+ const nativeDefine = window.customElements.define;
21
+ const nativeGet = window.customElements.get;
22
+
23
+ /**
24
+ * Map of user-provided constructors to tag names.
25
+ *
26
+ * @type {Map<Function, string>}
27
+ */
28
+ const tagnameByConstructor = new Map();
29
+
30
+ /**
31
+ * Map of tag names to user-provided constructors.
32
+ *
33
+ * @type {Map<string, Function>}
34
+ */
35
+ const constructorByTagname = new Map();
36
+
37
+
38
+ /**
39
+ * Whether the constructors are being called by a browser process, ie parsing
40
+ * or createElement.
41
+ */
42
+ let browserConstruction = false;
43
+
44
+ /**
45
+ * Whether the constructors are being called by a user-space process, ie
46
+ * calling an element constructor.
47
+ */
48
+ let userConstruction = false;
49
+
50
+ window.HTMLElement = function() {
51
+ if (!browserConstruction) {
52
+ const tagname = tagnameByConstructor.get(this.constructor);
53
+ const fakeClass = nativeGet.call(window.customElements, tagname);
54
+
55
+ // Make sure that the fake constructor doesn't call back to this constructor
56
+ userConstruction = true;
57
+ const instance = new (fakeClass)();
58
+ return instance;
59
+ }
60
+ // Else do nothing. This will be reached by ES5-style classes doing
61
+ // HTMLElement.call() during initialization
62
+ browserConstruction = false;
63
+ };
64
+ // By setting the patched HTMLElement's prototype property to the native
65
+ // HTMLElement's prototype we make sure that:
66
+ // document.createElement('a') instanceof HTMLElement
67
+ // works because instanceof uses HTMLElement.prototype, which is on the
68
+ // ptototype chain of built-in elements.
69
+ window.HTMLElement.prototype = NativeHTMLElement.prototype;
70
+
71
+ window.customElements.define = (tagname, elementClass) => {
72
+ const elementProto = elementClass.prototype;
73
+ const StandInElement = class extends NativeHTMLElement {
74
+ constructor() {
75
+ // Call the native HTMLElement constructor, this gives us the
76
+ // under-construction instance as `this`:
77
+ super();
78
+
79
+ // The prototype will be wrong up because the browser used our fake
80
+ // class, so fix it:
81
+ Object.setPrototypeOf(this, elementProto);
82
+
83
+ if (!userConstruction) {
84
+ // Make sure that user-defined constructor bottom's out to a do-nothing
85
+ // HTMLElement() call
86
+ browserConstruction = true;
87
+ // Call the user-defined constructor on our instance:
88
+ elementClass.call(this);
79
89
  }
80
- };
81
- const standInProto = StandInElement.prototype;
82
- StandInElement.observedAttributes = elementClass.observedAttributes;
83
- standInProto.connectedCallback = elementProto.connectedCallback;
84
- standInProto.disconnectedCallback = elementProto.disconnectedCallback;
85
- standInProto.attributeChangedCallback = elementProto.attributeChangedCallback;
86
- standInProto.adoptedCallback = elementProto.adoptedCallback;
87
-
88
- tagnameByConstructor.set(elementClass, tagname);
89
- constructorByTagname.set(tagname, elementClass);
90
- nativeDefine.call(window.customElements, tagname, StandInElement);
90
+ userConstruction = false;
91
+ }
91
92
  };
93
+ const standInProto = StandInElement.prototype;
94
+ StandInElement.observedAttributes = elementClass.observedAttributes;
95
+ standInProto.connectedCallback = elementProto.connectedCallback;
96
+ standInProto.disconnectedCallback = elementProto.disconnectedCallback;
97
+ standInProto.attributeChangedCallback = elementProto.attributeChangedCallback;
98
+ standInProto.adoptedCallback = elementProto.adoptedCallback;
99
+
100
+ tagnameByConstructor.set(elementClass, tagname);
101
+ constructorByTagname.set(tagname, elementClass);
102
+ nativeDefine.call(window.customElements, tagname, StandInElement);
103
+ };
92
104
 
93
- window.customElements.get = (tagname) => constructorByTagname.get(tagname);
105
+ window.customElements.get = (tagname) => constructorByTagname.get(tagname);
94
106
 
95
- })();
107
+ })();
96
108
  '''
@@ -1,3 +1,2 @@
1
- #= require ./es6
2
- #= require ./custom-elements
3
1
  #= require ./native-shim
2
+ #= require ./custom-elements
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tao_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siyuan Liu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-20 00:00:00.000000000 Z
12
+ date: 2017-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turbolinks
@@ -195,7 +195,6 @@ files:
195
195
  - lib/templates/plugin/templates/test/plugin_name_test.rb
196
196
  - lib/templates/plugin/templates/test/test_helper.rb
197
197
  - vendor/assets/javascripts/polyfills/custom-elements.js
198
- - vendor/assets/javascripts/polyfills/es6.js
199
198
  - vendor/assets/javascripts/polyfills/native-shim.coffee
200
199
  - vendor/assets/javascripts/polyfills/polyfills.coffee
201
200
  - vendor/assets/stylesheets/normalize.css