polymer-rails 1.2.4.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/polymer/component/component_generator.rb +7 -3
- data/lib/generators/polymer/component/templates/component.html.erb +3 -3
- data/lib/generators/polymer/component/templates/component.js.erb +1 -1
- data/lib/polymer-rails/version.rb +1 -1
- data/lib/polymer-rails/xml_adapters/nokogiri.rb +5 -1
- metadata +3 -20
- data/app/assets/javascripts/polymer/LICENSE.txt +0 -27
- data/app/assets/javascripts/polymer/bower.json +0 -29
- data/app/assets/javascripts/polymer/build.log +0 -466
- data/app/assets/javascripts/webcomponentsjs/CustomElements.js +0 -1041
- data/app/assets/javascripts/webcomponentsjs/CustomElements.min.js +0 -11
- data/app/assets/javascripts/webcomponentsjs/HTMLImports.js +0 -1157
- data/app/assets/javascripts/webcomponentsjs/HTMLImports.min.js +0 -11
- data/app/assets/javascripts/webcomponentsjs/MutationObserver.js +0 -350
- data/app/assets/javascripts/webcomponentsjs/MutationObserver.min.js +0 -11
- data/app/assets/javascripts/webcomponentsjs/README.md +0 -125
- data/app/assets/javascripts/webcomponentsjs/ShadowDOM.js +0 -4496
- data/app/assets/javascripts/webcomponentsjs/ShadowDOM.min.js +0 -13
- data/app/assets/javascripts/webcomponentsjs/bower.json +0 -21
- data/app/assets/javascripts/webcomponentsjs/build.log +0 -33
- data/app/assets/javascripts/webcomponentsjs/package.json +0 -31
- data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.min.js +0 -12
- data/app/assets/javascripts/webcomponentsjs/webcomponents.min.js +0 -14
@@ -1,1041 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license
|
3
|
-
* Copyright (c) 2014 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
|
-
*/
|
10
|
-
// @version 0.7.20
|
11
|
-
if (typeof WeakMap === "undefined") {
|
12
|
-
(function() {
|
13
|
-
var defineProperty = Object.defineProperty;
|
14
|
-
var counter = Date.now() % 1e9;
|
15
|
-
var WeakMap = function() {
|
16
|
-
this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
|
17
|
-
};
|
18
|
-
WeakMap.prototype = {
|
19
|
-
set: function(key, value) {
|
20
|
-
var entry = key[this.name];
|
21
|
-
if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
|
22
|
-
value: [ key, value ],
|
23
|
-
writable: true
|
24
|
-
});
|
25
|
-
return this;
|
26
|
-
},
|
27
|
-
get: function(key) {
|
28
|
-
var entry;
|
29
|
-
return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
|
30
|
-
},
|
31
|
-
"delete": function(key) {
|
32
|
-
var entry = key[this.name];
|
33
|
-
if (!entry || entry[0] !== key) return false;
|
34
|
-
entry[0] = entry[1] = undefined;
|
35
|
-
return true;
|
36
|
-
},
|
37
|
-
has: function(key) {
|
38
|
-
var entry = key[this.name];
|
39
|
-
if (!entry) return false;
|
40
|
-
return entry[0] === key;
|
41
|
-
}
|
42
|
-
};
|
43
|
-
window.WeakMap = WeakMap;
|
44
|
-
})();
|
45
|
-
}
|
46
|
-
|
47
|
-
(function(global) {
|
48
|
-
if (global.JsMutationObserver) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
var registrationsTable = new WeakMap();
|
52
|
-
var setImmediate;
|
53
|
-
if (/Trident|Edge/.test(navigator.userAgent)) {
|
54
|
-
setImmediate = setTimeout;
|
55
|
-
} else if (window.setImmediate) {
|
56
|
-
setImmediate = window.setImmediate;
|
57
|
-
} else {
|
58
|
-
var setImmediateQueue = [];
|
59
|
-
var sentinel = String(Math.random());
|
60
|
-
window.addEventListener("message", function(e) {
|
61
|
-
if (e.data === sentinel) {
|
62
|
-
var queue = setImmediateQueue;
|
63
|
-
setImmediateQueue = [];
|
64
|
-
queue.forEach(function(func) {
|
65
|
-
func();
|
66
|
-
});
|
67
|
-
}
|
68
|
-
});
|
69
|
-
setImmediate = function(func) {
|
70
|
-
setImmediateQueue.push(func);
|
71
|
-
window.postMessage(sentinel, "*");
|
72
|
-
};
|
73
|
-
}
|
74
|
-
var isScheduled = false;
|
75
|
-
var scheduledObservers = [];
|
76
|
-
function scheduleCallback(observer) {
|
77
|
-
scheduledObservers.push(observer);
|
78
|
-
if (!isScheduled) {
|
79
|
-
isScheduled = true;
|
80
|
-
setImmediate(dispatchCallbacks);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
function wrapIfNeeded(node) {
|
84
|
-
return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
|
85
|
-
}
|
86
|
-
function dispatchCallbacks() {
|
87
|
-
isScheduled = false;
|
88
|
-
var observers = scheduledObservers;
|
89
|
-
scheduledObservers = [];
|
90
|
-
observers.sort(function(o1, o2) {
|
91
|
-
return o1.uid_ - o2.uid_;
|
92
|
-
});
|
93
|
-
var anyNonEmpty = false;
|
94
|
-
observers.forEach(function(observer) {
|
95
|
-
var queue = observer.takeRecords();
|
96
|
-
removeTransientObserversFor(observer);
|
97
|
-
if (queue.length) {
|
98
|
-
observer.callback_(queue, observer);
|
99
|
-
anyNonEmpty = true;
|
100
|
-
}
|
101
|
-
});
|
102
|
-
if (anyNonEmpty) dispatchCallbacks();
|
103
|
-
}
|
104
|
-
function removeTransientObserversFor(observer) {
|
105
|
-
observer.nodes_.forEach(function(node) {
|
106
|
-
var registrations = registrationsTable.get(node);
|
107
|
-
if (!registrations) return;
|
108
|
-
registrations.forEach(function(registration) {
|
109
|
-
if (registration.observer === observer) registration.removeTransientObservers();
|
110
|
-
});
|
111
|
-
});
|
112
|
-
}
|
113
|
-
function forEachAncestorAndObserverEnqueueRecord(target, callback) {
|
114
|
-
for (var node = target; node; node = node.parentNode) {
|
115
|
-
var registrations = registrationsTable.get(node);
|
116
|
-
if (registrations) {
|
117
|
-
for (var j = 0; j < registrations.length; j++) {
|
118
|
-
var registration = registrations[j];
|
119
|
-
var options = registration.options;
|
120
|
-
if (node !== target && !options.subtree) continue;
|
121
|
-
var record = callback(options);
|
122
|
-
if (record) registration.enqueue(record);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
127
|
-
var uidCounter = 0;
|
128
|
-
function JsMutationObserver(callback) {
|
129
|
-
this.callback_ = callback;
|
130
|
-
this.nodes_ = [];
|
131
|
-
this.records_ = [];
|
132
|
-
this.uid_ = ++uidCounter;
|
133
|
-
}
|
134
|
-
JsMutationObserver.prototype = {
|
135
|
-
observe: function(target, options) {
|
136
|
-
target = wrapIfNeeded(target);
|
137
|
-
if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
|
138
|
-
throw new SyntaxError();
|
139
|
-
}
|
140
|
-
var registrations = registrationsTable.get(target);
|
141
|
-
if (!registrations) registrationsTable.set(target, registrations = []);
|
142
|
-
var registration;
|
143
|
-
for (var i = 0; i < registrations.length; i++) {
|
144
|
-
if (registrations[i].observer === this) {
|
145
|
-
registration = registrations[i];
|
146
|
-
registration.removeListeners();
|
147
|
-
registration.options = options;
|
148
|
-
break;
|
149
|
-
}
|
150
|
-
}
|
151
|
-
if (!registration) {
|
152
|
-
registration = new Registration(this, target, options);
|
153
|
-
registrations.push(registration);
|
154
|
-
this.nodes_.push(target);
|
155
|
-
}
|
156
|
-
registration.addListeners();
|
157
|
-
},
|
158
|
-
disconnect: function() {
|
159
|
-
this.nodes_.forEach(function(node) {
|
160
|
-
var registrations = registrationsTable.get(node);
|
161
|
-
for (var i = 0; i < registrations.length; i++) {
|
162
|
-
var registration = registrations[i];
|
163
|
-
if (registration.observer === this) {
|
164
|
-
registration.removeListeners();
|
165
|
-
registrations.splice(i, 1);
|
166
|
-
break;
|
167
|
-
}
|
168
|
-
}
|
169
|
-
}, this);
|
170
|
-
this.records_ = [];
|
171
|
-
},
|
172
|
-
takeRecords: function() {
|
173
|
-
var copyOfRecords = this.records_;
|
174
|
-
this.records_ = [];
|
175
|
-
return copyOfRecords;
|
176
|
-
}
|
177
|
-
};
|
178
|
-
function MutationRecord(type, target) {
|
179
|
-
this.type = type;
|
180
|
-
this.target = target;
|
181
|
-
this.addedNodes = [];
|
182
|
-
this.removedNodes = [];
|
183
|
-
this.previousSibling = null;
|
184
|
-
this.nextSibling = null;
|
185
|
-
this.attributeName = null;
|
186
|
-
this.attributeNamespace = null;
|
187
|
-
this.oldValue = null;
|
188
|
-
}
|
189
|
-
function copyMutationRecord(original) {
|
190
|
-
var record = new MutationRecord(original.type, original.target);
|
191
|
-
record.addedNodes = original.addedNodes.slice();
|
192
|
-
record.removedNodes = original.removedNodes.slice();
|
193
|
-
record.previousSibling = original.previousSibling;
|
194
|
-
record.nextSibling = original.nextSibling;
|
195
|
-
record.attributeName = original.attributeName;
|
196
|
-
record.attributeNamespace = original.attributeNamespace;
|
197
|
-
record.oldValue = original.oldValue;
|
198
|
-
return record;
|
199
|
-
}
|
200
|
-
var currentRecord, recordWithOldValue;
|
201
|
-
function getRecord(type, target) {
|
202
|
-
return currentRecord = new MutationRecord(type, target);
|
203
|
-
}
|
204
|
-
function getRecordWithOldValue(oldValue) {
|
205
|
-
if (recordWithOldValue) return recordWithOldValue;
|
206
|
-
recordWithOldValue = copyMutationRecord(currentRecord);
|
207
|
-
recordWithOldValue.oldValue = oldValue;
|
208
|
-
return recordWithOldValue;
|
209
|
-
}
|
210
|
-
function clearRecords() {
|
211
|
-
currentRecord = recordWithOldValue = undefined;
|
212
|
-
}
|
213
|
-
function recordRepresentsCurrentMutation(record) {
|
214
|
-
return record === recordWithOldValue || record === currentRecord;
|
215
|
-
}
|
216
|
-
function selectRecord(lastRecord, newRecord) {
|
217
|
-
if (lastRecord === newRecord) return lastRecord;
|
218
|
-
if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
|
219
|
-
return null;
|
220
|
-
}
|
221
|
-
function Registration(observer, target, options) {
|
222
|
-
this.observer = observer;
|
223
|
-
this.target = target;
|
224
|
-
this.options = options;
|
225
|
-
this.transientObservedNodes = [];
|
226
|
-
}
|
227
|
-
Registration.prototype = {
|
228
|
-
enqueue: function(record) {
|
229
|
-
var records = this.observer.records_;
|
230
|
-
var length = records.length;
|
231
|
-
if (records.length > 0) {
|
232
|
-
var lastRecord = records[length - 1];
|
233
|
-
var recordToReplaceLast = selectRecord(lastRecord, record);
|
234
|
-
if (recordToReplaceLast) {
|
235
|
-
records[length - 1] = recordToReplaceLast;
|
236
|
-
return;
|
237
|
-
}
|
238
|
-
} else {
|
239
|
-
scheduleCallback(this.observer);
|
240
|
-
}
|
241
|
-
records[length] = record;
|
242
|
-
},
|
243
|
-
addListeners: function() {
|
244
|
-
this.addListeners_(this.target);
|
245
|
-
},
|
246
|
-
addListeners_: function(node) {
|
247
|
-
var options = this.options;
|
248
|
-
if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
|
249
|
-
if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
|
250
|
-
if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
|
251
|
-
if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
|
252
|
-
},
|
253
|
-
removeListeners: function() {
|
254
|
-
this.removeListeners_(this.target);
|
255
|
-
},
|
256
|
-
removeListeners_: function(node) {
|
257
|
-
var options = this.options;
|
258
|
-
if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
|
259
|
-
if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
|
260
|
-
if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
|
261
|
-
if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
|
262
|
-
},
|
263
|
-
addTransientObserver: function(node) {
|
264
|
-
if (node === this.target) return;
|
265
|
-
this.addListeners_(node);
|
266
|
-
this.transientObservedNodes.push(node);
|
267
|
-
var registrations = registrationsTable.get(node);
|
268
|
-
if (!registrations) registrationsTable.set(node, registrations = []);
|
269
|
-
registrations.push(this);
|
270
|
-
},
|
271
|
-
removeTransientObservers: function() {
|
272
|
-
var transientObservedNodes = this.transientObservedNodes;
|
273
|
-
this.transientObservedNodes = [];
|
274
|
-
transientObservedNodes.forEach(function(node) {
|
275
|
-
this.removeListeners_(node);
|
276
|
-
var registrations = registrationsTable.get(node);
|
277
|
-
for (var i = 0; i < registrations.length; i++) {
|
278
|
-
if (registrations[i] === this) {
|
279
|
-
registrations.splice(i, 1);
|
280
|
-
break;
|
281
|
-
}
|
282
|
-
}
|
283
|
-
}, this);
|
284
|
-
},
|
285
|
-
handleEvent: function(e) {
|
286
|
-
e.stopImmediatePropagation();
|
287
|
-
switch (e.type) {
|
288
|
-
case "DOMAttrModified":
|
289
|
-
var name = e.attrName;
|
290
|
-
var namespace = e.relatedNode.namespaceURI;
|
291
|
-
var target = e.target;
|
292
|
-
var record = new getRecord("attributes", target);
|
293
|
-
record.attributeName = name;
|
294
|
-
record.attributeNamespace = namespace;
|
295
|
-
var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
|
296
|
-
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
297
|
-
if (!options.attributes) return;
|
298
|
-
if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
|
299
|
-
return;
|
300
|
-
}
|
301
|
-
if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
|
302
|
-
return record;
|
303
|
-
});
|
304
|
-
break;
|
305
|
-
|
306
|
-
case "DOMCharacterDataModified":
|
307
|
-
var target = e.target;
|
308
|
-
var record = getRecord("characterData", target);
|
309
|
-
var oldValue = e.prevValue;
|
310
|
-
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
311
|
-
if (!options.characterData) return;
|
312
|
-
if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
|
313
|
-
return record;
|
314
|
-
});
|
315
|
-
break;
|
316
|
-
|
317
|
-
case "DOMNodeRemoved":
|
318
|
-
this.addTransientObserver(e.target);
|
319
|
-
|
320
|
-
case "DOMNodeInserted":
|
321
|
-
var changedNode = e.target;
|
322
|
-
var addedNodes, removedNodes;
|
323
|
-
if (e.type === "DOMNodeInserted") {
|
324
|
-
addedNodes = [ changedNode ];
|
325
|
-
removedNodes = [];
|
326
|
-
} else {
|
327
|
-
addedNodes = [];
|
328
|
-
removedNodes = [ changedNode ];
|
329
|
-
}
|
330
|
-
var previousSibling = changedNode.previousSibling;
|
331
|
-
var nextSibling = changedNode.nextSibling;
|
332
|
-
var record = getRecord("childList", e.target.parentNode);
|
333
|
-
record.addedNodes = addedNodes;
|
334
|
-
record.removedNodes = removedNodes;
|
335
|
-
record.previousSibling = previousSibling;
|
336
|
-
record.nextSibling = nextSibling;
|
337
|
-
forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
|
338
|
-
if (!options.childList) return;
|
339
|
-
return record;
|
340
|
-
});
|
341
|
-
}
|
342
|
-
clearRecords();
|
343
|
-
}
|
344
|
-
};
|
345
|
-
global.JsMutationObserver = JsMutationObserver;
|
346
|
-
if (!global.MutationObserver) {
|
347
|
-
global.MutationObserver = JsMutationObserver;
|
348
|
-
JsMutationObserver._isPolyfilled = true;
|
349
|
-
}
|
350
|
-
})(self);
|
351
|
-
|
352
|
-
(function(scope) {
|
353
|
-
"use strict";
|
354
|
-
if (!window.performance) {
|
355
|
-
var start = Date.now();
|
356
|
-
window.performance = {
|
357
|
-
now: function() {
|
358
|
-
return Date.now() - start;
|
359
|
-
}
|
360
|
-
};
|
361
|
-
}
|
362
|
-
if (!window.requestAnimationFrame) {
|
363
|
-
window.requestAnimationFrame = function() {
|
364
|
-
var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
365
|
-
return nativeRaf ? function(callback) {
|
366
|
-
return nativeRaf(function() {
|
367
|
-
callback(performance.now());
|
368
|
-
});
|
369
|
-
} : function(callback) {
|
370
|
-
return window.setTimeout(callback, 1e3 / 60);
|
371
|
-
};
|
372
|
-
}();
|
373
|
-
}
|
374
|
-
if (!window.cancelAnimationFrame) {
|
375
|
-
window.cancelAnimationFrame = function() {
|
376
|
-
return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
|
377
|
-
clearTimeout(id);
|
378
|
-
};
|
379
|
-
}();
|
380
|
-
}
|
381
|
-
var workingDefaultPrevented = function() {
|
382
|
-
var e = document.createEvent("Event");
|
383
|
-
e.initEvent("foo", true, true);
|
384
|
-
e.preventDefault();
|
385
|
-
return e.defaultPrevented;
|
386
|
-
}();
|
387
|
-
if (!workingDefaultPrevented) {
|
388
|
-
var origPreventDefault = Event.prototype.preventDefault;
|
389
|
-
Event.prototype.preventDefault = function() {
|
390
|
-
if (!this.cancelable) {
|
391
|
-
return;
|
392
|
-
}
|
393
|
-
origPreventDefault.call(this);
|
394
|
-
Object.defineProperty(this, "defaultPrevented", {
|
395
|
-
get: function() {
|
396
|
-
return true;
|
397
|
-
},
|
398
|
-
configurable: true
|
399
|
-
});
|
400
|
-
};
|
401
|
-
}
|
402
|
-
var isIE = /Trident/.test(navigator.userAgent);
|
403
|
-
if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
|
404
|
-
window.CustomEvent = function(inType, params) {
|
405
|
-
params = params || {};
|
406
|
-
var e = document.createEvent("CustomEvent");
|
407
|
-
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
408
|
-
return e;
|
409
|
-
};
|
410
|
-
window.CustomEvent.prototype = window.Event.prototype;
|
411
|
-
}
|
412
|
-
if (!window.Event || isIE && typeof window.Event !== "function") {
|
413
|
-
var origEvent = window.Event;
|
414
|
-
window.Event = function(inType, params) {
|
415
|
-
params = params || {};
|
416
|
-
var e = document.createEvent("Event");
|
417
|
-
e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
|
418
|
-
return e;
|
419
|
-
};
|
420
|
-
window.Event.prototype = origEvent.prototype;
|
421
|
-
}
|
422
|
-
})(window.WebComponents);
|
423
|
-
|
424
|
-
window.CustomElements = window.CustomElements || {
|
425
|
-
flags: {}
|
426
|
-
};
|
427
|
-
|
428
|
-
(function(scope) {
|
429
|
-
var flags = scope.flags;
|
430
|
-
var modules = [];
|
431
|
-
var addModule = function(module) {
|
432
|
-
modules.push(module);
|
433
|
-
};
|
434
|
-
var initializeModules = function() {
|
435
|
-
modules.forEach(function(module) {
|
436
|
-
module(scope);
|
437
|
-
});
|
438
|
-
};
|
439
|
-
scope.addModule = addModule;
|
440
|
-
scope.initializeModules = initializeModules;
|
441
|
-
scope.hasNative = Boolean(document.registerElement);
|
442
|
-
scope.isIE = /Trident/.test(navigator.userAgent);
|
443
|
-
scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || window.HTMLImports.useNative);
|
444
|
-
})(window.CustomElements);
|
445
|
-
|
446
|
-
window.CustomElements.addModule(function(scope) {
|
447
|
-
var IMPORT_LINK_TYPE = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYPE : "none";
|
448
|
-
function forSubtree(node, cb) {
|
449
|
-
findAllElements(node, function(e) {
|
450
|
-
if (cb(e)) {
|
451
|
-
return true;
|
452
|
-
}
|
453
|
-
forRoots(e, cb);
|
454
|
-
});
|
455
|
-
forRoots(node, cb);
|
456
|
-
}
|
457
|
-
function findAllElements(node, find, data) {
|
458
|
-
var e = node.firstElementChild;
|
459
|
-
if (!e) {
|
460
|
-
e = node.firstChild;
|
461
|
-
while (e && e.nodeType !== Node.ELEMENT_NODE) {
|
462
|
-
e = e.nextSibling;
|
463
|
-
}
|
464
|
-
}
|
465
|
-
while (e) {
|
466
|
-
if (find(e, data) !== true) {
|
467
|
-
findAllElements(e, find, data);
|
468
|
-
}
|
469
|
-
e = e.nextElementSibling;
|
470
|
-
}
|
471
|
-
return null;
|
472
|
-
}
|
473
|
-
function forRoots(node, cb) {
|
474
|
-
var root = node.shadowRoot;
|
475
|
-
while (root) {
|
476
|
-
forSubtree(root, cb);
|
477
|
-
root = root.olderShadowRoot;
|
478
|
-
}
|
479
|
-
}
|
480
|
-
function forDocumentTree(doc, cb) {
|
481
|
-
_forDocumentTree(doc, cb, []);
|
482
|
-
}
|
483
|
-
function _forDocumentTree(doc, cb, processingDocuments) {
|
484
|
-
doc = window.wrap(doc);
|
485
|
-
if (processingDocuments.indexOf(doc) >= 0) {
|
486
|
-
return;
|
487
|
-
}
|
488
|
-
processingDocuments.push(doc);
|
489
|
-
var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
|
490
|
-
for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
|
491
|
-
if (n.import) {
|
492
|
-
_forDocumentTree(n.import, cb, processingDocuments);
|
493
|
-
}
|
494
|
-
}
|
495
|
-
cb(doc);
|
496
|
-
}
|
497
|
-
scope.forDocumentTree = forDocumentTree;
|
498
|
-
scope.forSubtree = forSubtree;
|
499
|
-
});
|
500
|
-
|
501
|
-
window.CustomElements.addModule(function(scope) {
|
502
|
-
var flags = scope.flags;
|
503
|
-
var forSubtree = scope.forSubtree;
|
504
|
-
var forDocumentTree = scope.forDocumentTree;
|
505
|
-
function addedNode(node, isAttached) {
|
506
|
-
return added(node, isAttached) || addedSubtree(node, isAttached);
|
507
|
-
}
|
508
|
-
function added(node, isAttached) {
|
509
|
-
if (scope.upgrade(node, isAttached)) {
|
510
|
-
return true;
|
511
|
-
}
|
512
|
-
if (isAttached) {
|
513
|
-
attached(node);
|
514
|
-
}
|
515
|
-
}
|
516
|
-
function addedSubtree(node, isAttached) {
|
517
|
-
forSubtree(node, function(e) {
|
518
|
-
if (added(e, isAttached)) {
|
519
|
-
return true;
|
520
|
-
}
|
521
|
-
});
|
522
|
-
}
|
523
|
-
var hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["throttle-attached"];
|
524
|
-
scope.hasPolyfillMutations = hasThrottledAttached;
|
525
|
-
scope.hasThrottledAttached = hasThrottledAttached;
|
526
|
-
var isPendingMutations = false;
|
527
|
-
var pendingMutations = [];
|
528
|
-
function deferMutation(fn) {
|
529
|
-
pendingMutations.push(fn);
|
530
|
-
if (!isPendingMutations) {
|
531
|
-
isPendingMutations = true;
|
532
|
-
setTimeout(takeMutations);
|
533
|
-
}
|
534
|
-
}
|
535
|
-
function takeMutations() {
|
536
|
-
isPendingMutations = false;
|
537
|
-
var $p = pendingMutations;
|
538
|
-
for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
|
539
|
-
p();
|
540
|
-
}
|
541
|
-
pendingMutations = [];
|
542
|
-
}
|
543
|
-
function attached(element) {
|
544
|
-
if (hasThrottledAttached) {
|
545
|
-
deferMutation(function() {
|
546
|
-
_attached(element);
|
547
|
-
});
|
548
|
-
} else {
|
549
|
-
_attached(element);
|
550
|
-
}
|
551
|
-
}
|
552
|
-
function _attached(element) {
|
553
|
-
if (element.__upgraded__ && !element.__attached) {
|
554
|
-
element.__attached = true;
|
555
|
-
if (element.attachedCallback) {
|
556
|
-
element.attachedCallback();
|
557
|
-
}
|
558
|
-
}
|
559
|
-
}
|
560
|
-
function detachedNode(node) {
|
561
|
-
detached(node);
|
562
|
-
forSubtree(node, function(e) {
|
563
|
-
detached(e);
|
564
|
-
});
|
565
|
-
}
|
566
|
-
function detached(element) {
|
567
|
-
if (hasThrottledAttached) {
|
568
|
-
deferMutation(function() {
|
569
|
-
_detached(element);
|
570
|
-
});
|
571
|
-
} else {
|
572
|
-
_detached(element);
|
573
|
-
}
|
574
|
-
}
|
575
|
-
function _detached(element) {
|
576
|
-
if (element.__upgraded__ && element.__attached) {
|
577
|
-
element.__attached = false;
|
578
|
-
if (element.detachedCallback) {
|
579
|
-
element.detachedCallback();
|
580
|
-
}
|
581
|
-
}
|
582
|
-
}
|
583
|
-
function inDocument(element) {
|
584
|
-
var p = element;
|
585
|
-
var doc = window.wrap(document);
|
586
|
-
while (p) {
|
587
|
-
if (p == doc) {
|
588
|
-
return true;
|
589
|
-
}
|
590
|
-
p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host;
|
591
|
-
}
|
592
|
-
}
|
593
|
-
function watchShadow(node) {
|
594
|
-
if (node.shadowRoot && !node.shadowRoot.__watched) {
|
595
|
-
flags.dom && console.log("watching shadow-root for: ", node.localName);
|
596
|
-
var root = node.shadowRoot;
|
597
|
-
while (root) {
|
598
|
-
observe(root);
|
599
|
-
root = root.olderShadowRoot;
|
600
|
-
}
|
601
|
-
}
|
602
|
-
}
|
603
|
-
function handler(root, mutations) {
|
604
|
-
if (flags.dom) {
|
605
|
-
var mx = mutations[0];
|
606
|
-
if (mx && mx.type === "childList" && mx.addedNodes) {
|
607
|
-
if (mx.addedNodes) {
|
608
|
-
var d = mx.addedNodes[0];
|
609
|
-
while (d && d !== document && !d.host) {
|
610
|
-
d = d.parentNode;
|
611
|
-
}
|
612
|
-
var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
|
613
|
-
u = u.split("/?").shift().split("/").pop();
|
614
|
-
}
|
615
|
-
}
|
616
|
-
console.group("mutations (%d) [%s]", mutations.length, u || "");
|
617
|
-
}
|
618
|
-
var isAttached = inDocument(root);
|
619
|
-
mutations.forEach(function(mx) {
|
620
|
-
if (mx.type === "childList") {
|
621
|
-
forEach(mx.addedNodes, function(n) {
|
622
|
-
if (!n.localName) {
|
623
|
-
return;
|
624
|
-
}
|
625
|
-
addedNode(n, isAttached);
|
626
|
-
});
|
627
|
-
forEach(mx.removedNodes, function(n) {
|
628
|
-
if (!n.localName) {
|
629
|
-
return;
|
630
|
-
}
|
631
|
-
detachedNode(n);
|
632
|
-
});
|
633
|
-
}
|
634
|
-
});
|
635
|
-
flags.dom && console.groupEnd();
|
636
|
-
}
|
637
|
-
function takeRecords(node) {
|
638
|
-
node = window.wrap(node);
|
639
|
-
if (!node) {
|
640
|
-
node = window.wrap(document);
|
641
|
-
}
|
642
|
-
while (node.parentNode) {
|
643
|
-
node = node.parentNode;
|
644
|
-
}
|
645
|
-
var observer = node.__observer;
|
646
|
-
if (observer) {
|
647
|
-
handler(node, observer.takeRecords());
|
648
|
-
takeMutations();
|
649
|
-
}
|
650
|
-
}
|
651
|
-
var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
|
652
|
-
function observe(inRoot) {
|
653
|
-
if (inRoot.__observer) {
|
654
|
-
return;
|
655
|
-
}
|
656
|
-
var observer = new MutationObserver(handler.bind(this, inRoot));
|
657
|
-
observer.observe(inRoot, {
|
658
|
-
childList: true,
|
659
|
-
subtree: true
|
660
|
-
});
|
661
|
-
inRoot.__observer = observer;
|
662
|
-
}
|
663
|
-
function upgradeDocument(doc) {
|
664
|
-
doc = window.wrap(doc);
|
665
|
-
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
|
666
|
-
var isMainDocument = doc === window.wrap(document);
|
667
|
-
addedNode(doc, isMainDocument);
|
668
|
-
observe(doc);
|
669
|
-
flags.dom && console.groupEnd();
|
670
|
-
}
|
671
|
-
function upgradeDocumentTree(doc) {
|
672
|
-
forDocumentTree(doc, upgradeDocument);
|
673
|
-
}
|
674
|
-
var originalCreateShadowRoot = Element.prototype.createShadowRoot;
|
675
|
-
if (originalCreateShadowRoot) {
|
676
|
-
Element.prototype.createShadowRoot = function() {
|
677
|
-
var root = originalCreateShadowRoot.call(this);
|
678
|
-
window.CustomElements.watchShadow(this);
|
679
|
-
return root;
|
680
|
-
};
|
681
|
-
}
|
682
|
-
scope.watchShadow = watchShadow;
|
683
|
-
scope.upgradeDocumentTree = upgradeDocumentTree;
|
684
|
-
scope.upgradeDocument = upgradeDocument;
|
685
|
-
scope.upgradeSubtree = addedSubtree;
|
686
|
-
scope.upgradeAll = addedNode;
|
687
|
-
scope.attached = attached;
|
688
|
-
scope.takeRecords = takeRecords;
|
689
|
-
});
|
690
|
-
|
691
|
-
window.CustomElements.addModule(function(scope) {
|
692
|
-
var flags = scope.flags;
|
693
|
-
function upgrade(node, isAttached) {
|
694
|
-
if (node.localName === "template") {
|
695
|
-
if (window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
|
696
|
-
HTMLTemplateElement.decorate(node);
|
697
|
-
}
|
698
|
-
}
|
699
|
-
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
700
|
-
var is = node.getAttribute("is");
|
701
|
-
var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
|
702
|
-
if (definition) {
|
703
|
-
if (is && definition.tag == node.localName || !is && !definition.extends) {
|
704
|
-
return upgradeWithDefinition(node, definition, isAttached);
|
705
|
-
}
|
706
|
-
}
|
707
|
-
}
|
708
|
-
}
|
709
|
-
function upgradeWithDefinition(element, definition, isAttached) {
|
710
|
-
flags.upgrade && console.group("upgrade:", element.localName);
|
711
|
-
if (definition.is) {
|
712
|
-
element.setAttribute("is", definition.is);
|
713
|
-
}
|
714
|
-
implementPrototype(element, definition);
|
715
|
-
element.__upgraded__ = true;
|
716
|
-
created(element);
|
717
|
-
if (isAttached) {
|
718
|
-
scope.attached(element);
|
719
|
-
}
|
720
|
-
scope.upgradeSubtree(element, isAttached);
|
721
|
-
flags.upgrade && console.groupEnd();
|
722
|
-
return element;
|
723
|
-
}
|
724
|
-
function implementPrototype(element, definition) {
|
725
|
-
if (Object.__proto__) {
|
726
|
-
element.__proto__ = definition.prototype;
|
727
|
-
} else {
|
728
|
-
customMixin(element, definition.prototype, definition.native);
|
729
|
-
element.__proto__ = definition.prototype;
|
730
|
-
}
|
731
|
-
}
|
732
|
-
function customMixin(inTarget, inSrc, inNative) {
|
733
|
-
var used = {};
|
734
|
-
var p = inSrc;
|
735
|
-
while (p !== inNative && p !== HTMLElement.prototype) {
|
736
|
-
var keys = Object.getOwnPropertyNames(p);
|
737
|
-
for (var i = 0, k; k = keys[i]; i++) {
|
738
|
-
if (!used[k]) {
|
739
|
-
Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
|
740
|
-
used[k] = 1;
|
741
|
-
}
|
742
|
-
}
|
743
|
-
p = Object.getPrototypeOf(p);
|
744
|
-
}
|
745
|
-
}
|
746
|
-
function created(element) {
|
747
|
-
if (element.createdCallback) {
|
748
|
-
element.createdCallback();
|
749
|
-
}
|
750
|
-
}
|
751
|
-
scope.upgrade = upgrade;
|
752
|
-
scope.upgradeWithDefinition = upgradeWithDefinition;
|
753
|
-
scope.implementPrototype = implementPrototype;
|
754
|
-
});
|
755
|
-
|
756
|
-
window.CustomElements.addModule(function(scope) {
|
757
|
-
var isIE = scope.isIE;
|
758
|
-
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
759
|
-
var upgradeAll = scope.upgradeAll;
|
760
|
-
var upgradeWithDefinition = scope.upgradeWithDefinition;
|
761
|
-
var implementPrototype = scope.implementPrototype;
|
762
|
-
var useNative = scope.useNative;
|
763
|
-
function register(name, options) {
|
764
|
-
var definition = options || {};
|
765
|
-
if (!name) {
|
766
|
-
throw new Error("document.registerElement: first argument `name` must not be empty");
|
767
|
-
}
|
768
|
-
if (name.indexOf("-") < 0) {
|
769
|
-
throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
|
770
|
-
}
|
771
|
-
if (isReservedTag(name)) {
|
772
|
-
throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
|
773
|
-
}
|
774
|
-
if (getRegisteredDefinition(name)) {
|
775
|
-
throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
|
776
|
-
}
|
777
|
-
if (!definition.prototype) {
|
778
|
-
definition.prototype = Object.create(HTMLElement.prototype);
|
779
|
-
}
|
780
|
-
definition.__name = name.toLowerCase();
|
781
|
-
definition.lifecycle = definition.lifecycle || {};
|
782
|
-
definition.ancestry = ancestry(definition.extends);
|
783
|
-
resolveTagName(definition);
|
784
|
-
resolvePrototypeChain(definition);
|
785
|
-
overrideAttributeApi(definition.prototype);
|
786
|
-
registerDefinition(definition.__name, definition);
|
787
|
-
definition.ctor = generateConstructor(definition);
|
788
|
-
definition.ctor.prototype = definition.prototype;
|
789
|
-
definition.prototype.constructor = definition.ctor;
|
790
|
-
if (scope.ready) {
|
791
|
-
upgradeDocumentTree(document);
|
792
|
-
}
|
793
|
-
return definition.ctor;
|
794
|
-
}
|
795
|
-
function overrideAttributeApi(prototype) {
|
796
|
-
if (prototype.setAttribute._polyfilled) {
|
797
|
-
return;
|
798
|
-
}
|
799
|
-
var setAttribute = prototype.setAttribute;
|
800
|
-
prototype.setAttribute = function(name, value) {
|
801
|
-
changeAttribute.call(this, name, value, setAttribute);
|
802
|
-
};
|
803
|
-
var removeAttribute = prototype.removeAttribute;
|
804
|
-
prototype.removeAttribute = function(name) {
|
805
|
-
changeAttribute.call(this, name, null, removeAttribute);
|
806
|
-
};
|
807
|
-
prototype.setAttribute._polyfilled = true;
|
808
|
-
}
|
809
|
-
function changeAttribute(name, value, operation) {
|
810
|
-
name = name.toLowerCase();
|
811
|
-
var oldValue = this.getAttribute(name);
|
812
|
-
operation.apply(this, arguments);
|
813
|
-
var newValue = this.getAttribute(name);
|
814
|
-
if (this.attributeChangedCallback && newValue !== oldValue) {
|
815
|
-
this.attributeChangedCallback(name, oldValue, newValue);
|
816
|
-
}
|
817
|
-
}
|
818
|
-
function isReservedTag(name) {
|
819
|
-
for (var i = 0; i < reservedTagList.length; i++) {
|
820
|
-
if (name === reservedTagList[i]) {
|
821
|
-
return true;
|
822
|
-
}
|
823
|
-
}
|
824
|
-
}
|
825
|
-
var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
|
826
|
-
function ancestry(extnds) {
|
827
|
-
var extendee = getRegisteredDefinition(extnds);
|
828
|
-
if (extendee) {
|
829
|
-
return ancestry(extendee.extends).concat([ extendee ]);
|
830
|
-
}
|
831
|
-
return [];
|
832
|
-
}
|
833
|
-
function resolveTagName(definition) {
|
834
|
-
var baseTag = definition.extends;
|
835
|
-
for (var i = 0, a; a = definition.ancestry[i]; i++) {
|
836
|
-
baseTag = a.is && a.tag;
|
837
|
-
}
|
838
|
-
definition.tag = baseTag || definition.__name;
|
839
|
-
if (baseTag) {
|
840
|
-
definition.is = definition.__name;
|
841
|
-
}
|
842
|
-
}
|
843
|
-
function resolvePrototypeChain(definition) {
|
844
|
-
if (!Object.__proto__) {
|
845
|
-
var nativePrototype = HTMLElement.prototype;
|
846
|
-
if (definition.is) {
|
847
|
-
var inst = document.createElement(definition.tag);
|
848
|
-
nativePrototype = Object.getPrototypeOf(inst);
|
849
|
-
}
|
850
|
-
var proto = definition.prototype, ancestor;
|
851
|
-
var foundPrototype = false;
|
852
|
-
while (proto) {
|
853
|
-
if (proto == nativePrototype) {
|
854
|
-
foundPrototype = true;
|
855
|
-
}
|
856
|
-
ancestor = Object.getPrototypeOf(proto);
|
857
|
-
if (ancestor) {
|
858
|
-
proto.__proto__ = ancestor;
|
859
|
-
}
|
860
|
-
proto = ancestor;
|
861
|
-
}
|
862
|
-
if (!foundPrototype) {
|
863
|
-
console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
|
864
|
-
}
|
865
|
-
definition.native = nativePrototype;
|
866
|
-
}
|
867
|
-
}
|
868
|
-
function instantiate(definition) {
|
869
|
-
return upgradeWithDefinition(domCreateElement(definition.tag), definition);
|
870
|
-
}
|
871
|
-
var registry = {};
|
872
|
-
function getRegisteredDefinition(name) {
|
873
|
-
if (name) {
|
874
|
-
return registry[name.toLowerCase()];
|
875
|
-
}
|
876
|
-
}
|
877
|
-
function registerDefinition(name, definition) {
|
878
|
-
registry[name] = definition;
|
879
|
-
}
|
880
|
-
function generateConstructor(definition) {
|
881
|
-
return function() {
|
882
|
-
return instantiate(definition);
|
883
|
-
};
|
884
|
-
}
|
885
|
-
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
886
|
-
function createElementNS(namespace, tag, typeExtension) {
|
887
|
-
if (namespace === HTML_NAMESPACE) {
|
888
|
-
return createElement(tag, typeExtension);
|
889
|
-
} else {
|
890
|
-
return domCreateElementNS(namespace, tag);
|
891
|
-
}
|
892
|
-
}
|
893
|
-
function createElement(tag, typeExtension) {
|
894
|
-
if (tag) {
|
895
|
-
tag = tag.toLowerCase();
|
896
|
-
}
|
897
|
-
if (typeExtension) {
|
898
|
-
typeExtension = typeExtension.toLowerCase();
|
899
|
-
}
|
900
|
-
var definition = getRegisteredDefinition(typeExtension || tag);
|
901
|
-
if (definition) {
|
902
|
-
if (tag == definition.tag && typeExtension == definition.is) {
|
903
|
-
return new definition.ctor();
|
904
|
-
}
|
905
|
-
if (!typeExtension && !definition.is) {
|
906
|
-
return new definition.ctor();
|
907
|
-
}
|
908
|
-
}
|
909
|
-
var element;
|
910
|
-
if (typeExtension) {
|
911
|
-
element = createElement(tag);
|
912
|
-
element.setAttribute("is", typeExtension);
|
913
|
-
return element;
|
914
|
-
}
|
915
|
-
element = domCreateElement(tag);
|
916
|
-
if (tag.indexOf("-") >= 0) {
|
917
|
-
implementPrototype(element, HTMLElement);
|
918
|
-
}
|
919
|
-
return element;
|
920
|
-
}
|
921
|
-
var domCreateElement = document.createElement.bind(document);
|
922
|
-
var domCreateElementNS = document.createElementNS.bind(document);
|
923
|
-
var isInstance;
|
924
|
-
if (!Object.__proto__ && !useNative) {
|
925
|
-
isInstance = function(obj, ctor) {
|
926
|
-
if (obj instanceof ctor) {
|
927
|
-
return true;
|
928
|
-
}
|
929
|
-
var p = obj;
|
930
|
-
while (p) {
|
931
|
-
if (p === ctor.prototype) {
|
932
|
-
return true;
|
933
|
-
}
|
934
|
-
p = p.__proto__;
|
935
|
-
}
|
936
|
-
return false;
|
937
|
-
};
|
938
|
-
} else {
|
939
|
-
isInstance = function(obj, base) {
|
940
|
-
return obj instanceof base;
|
941
|
-
};
|
942
|
-
}
|
943
|
-
function wrapDomMethodToForceUpgrade(obj, methodName) {
|
944
|
-
var orig = obj[methodName];
|
945
|
-
obj[methodName] = function() {
|
946
|
-
var n = orig.apply(this, arguments);
|
947
|
-
upgradeAll(n);
|
948
|
-
return n;
|
949
|
-
};
|
950
|
-
}
|
951
|
-
wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
|
952
|
-
wrapDomMethodToForceUpgrade(document, "importNode");
|
953
|
-
if (isIE) {
|
954
|
-
(function() {
|
955
|
-
var importNode = document.importNode;
|
956
|
-
document.importNode = function() {
|
957
|
-
var n = importNode.apply(document, arguments);
|
958
|
-
if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) {
|
959
|
-
var f = document.createDocumentFragment();
|
960
|
-
f.appendChild(n);
|
961
|
-
return f;
|
962
|
-
} else {
|
963
|
-
return n;
|
964
|
-
}
|
965
|
-
};
|
966
|
-
})();
|
967
|
-
}
|
968
|
-
document.registerElement = register;
|
969
|
-
document.createElement = createElement;
|
970
|
-
document.createElementNS = createElementNS;
|
971
|
-
scope.registry = registry;
|
972
|
-
scope.instanceof = isInstance;
|
973
|
-
scope.reservedTagList = reservedTagList;
|
974
|
-
scope.getRegisteredDefinition = getRegisteredDefinition;
|
975
|
-
document.register = document.registerElement;
|
976
|
-
});
|
977
|
-
|
978
|
-
(function(scope) {
|
979
|
-
var useNative = scope.useNative;
|
980
|
-
var initializeModules = scope.initializeModules;
|
981
|
-
var isIE = scope.isIE;
|
982
|
-
if (useNative) {
|
983
|
-
var nop = function() {};
|
984
|
-
scope.watchShadow = nop;
|
985
|
-
scope.upgrade = nop;
|
986
|
-
scope.upgradeAll = nop;
|
987
|
-
scope.upgradeDocumentTree = nop;
|
988
|
-
scope.upgradeSubtree = nop;
|
989
|
-
scope.takeRecords = nop;
|
990
|
-
scope.instanceof = function(obj, base) {
|
991
|
-
return obj instanceof base;
|
992
|
-
};
|
993
|
-
} else {
|
994
|
-
initializeModules();
|
995
|
-
}
|
996
|
-
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
997
|
-
var upgradeDocument = scope.upgradeDocument;
|
998
|
-
if (!window.wrap) {
|
999
|
-
if (window.ShadowDOMPolyfill) {
|
1000
|
-
window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded;
|
1001
|
-
window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded;
|
1002
|
-
} else {
|
1003
|
-
window.wrap = window.unwrap = function(node) {
|
1004
|
-
return node;
|
1005
|
-
};
|
1006
|
-
}
|
1007
|
-
}
|
1008
|
-
if (window.HTMLImports) {
|
1009
|
-
window.HTMLImports.__importsParsingHook = function(elt) {
|
1010
|
-
if (elt.import) {
|
1011
|
-
upgradeDocument(wrap(elt.import));
|
1012
|
-
}
|
1013
|
-
};
|
1014
|
-
}
|
1015
|
-
function bootstrap() {
|
1016
|
-
upgradeDocumentTree(window.wrap(document));
|
1017
|
-
window.CustomElements.ready = true;
|
1018
|
-
var requestAnimationFrame = window.requestAnimationFrame || function(f) {
|
1019
|
-
setTimeout(f, 16);
|
1020
|
-
};
|
1021
|
-
requestAnimationFrame(function() {
|
1022
|
-
setTimeout(function() {
|
1023
|
-
window.CustomElements.readyTime = Date.now();
|
1024
|
-
if (window.HTMLImports) {
|
1025
|
-
window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime;
|
1026
|
-
}
|
1027
|
-
document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
1028
|
-
bubbles: true
|
1029
|
-
}));
|
1030
|
-
});
|
1031
|
-
});
|
1032
|
-
}
|
1033
|
-
if (document.readyState === "complete" || scope.flags.eager) {
|
1034
|
-
bootstrap();
|
1035
|
-
} else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
|
1036
|
-
bootstrap();
|
1037
|
-
} else {
|
1038
|
-
var loadEvent = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
|
1039
|
-
window.addEventListener(loadEvent, bootstrap);
|
1040
|
-
}
|
1041
|
-
})(window.CustomElements);
|