tao_on_rails 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/tao/component.coffee +2 -1
- data/lib/tao_on_rails/version.rb +1 -1
- data/vendor/assets/javascripts/polyfills/custom-elements.js +54 -856
- data/vendor/assets/javascripts/polyfills/native-shim.coffee +101 -89
- data/vendor/assets/javascripts/polyfills/polyfills.coffee +1 -2
- metadata +2 -3
- data/vendor/assets/javascripts/polyfills/es6.js +0 -1963
@@ -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
|
11
|
+
if window.customElements
|
3
12
|
eval '''
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
//
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
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
|
-
|
105
|
+
window.customElements.get = (tagname) => constructorByTagname.get(tagname);
|
94
106
|
|
95
|
-
|
107
|
+
})();
|
96
108
|
'''
|
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.
|
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-
|
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
|