polymer-rails 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -3
  3. data/app/assets/javascripts/polymer/polymer-micro.html +36 -0
  4. data/app/assets/javascripts/polymer/polymer-mini.html +45 -0
  5. data/app/assets/javascripts/polymer/polymer.html +59 -11
  6. data/app/assets/javascripts/polymer/src/lib/annotations/annotations.html +262 -0
  7. data/app/assets/javascripts/polymer/src/lib/annotations/demo/app-chrome.html +60 -0
  8. data/app/assets/javascripts/polymer/src/lib/array-observe.html +118 -0
  9. data/app/assets/javascripts/polymer/src/lib/array-splice.html +262 -0
  10. data/app/assets/javascripts/polymer/src/lib/async.html +68 -0
  11. data/app/assets/javascripts/polymer/src/lib/base.html +117 -0
  12. data/app/assets/javascripts/polymer/src/lib/bind/accessors.html +223 -0
  13. data/app/assets/javascripts/polymer/src/lib/bind/demo/app-chrome.html +28 -0
  14. data/app/assets/javascripts/polymer/src/lib/bind/demo/app.html +29 -0
  15. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/annotations-bind-demo.html +76 -0
  16. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/bind-demo.html +83 -0
  17. data/app/assets/javascripts/polymer/src/lib/bind/effects.html +80 -0
  18. data/app/assets/javascripts/polymer/src/lib/case-map.html +46 -0
  19. data/app/assets/javascripts/polymer/src/lib/collection.html +179 -0
  20. data/app/assets/javascripts/polymer/src/lib/css-parse.html +131 -0
  21. data/app/assets/javascripts/polymer/src/lib/debounce.html +69 -0
  22. data/app/assets/javascripts/polymer/src/lib/dom-api.html +467 -0
  23. data/app/assets/javascripts/polymer/src/lib/dom-module.html +68 -0
  24. data/app/assets/javascripts/polymer/src/lib/event-api.html +92 -0
  25. data/app/assets/javascripts/polymer/src/lib/expr/focus.html +22 -0
  26. data/app/assets/javascripts/polymer/src/lib/expr/gestures.html +1 -0
  27. data/app/assets/javascripts/polymer/src/lib/expr/log.html +21 -0
  28. data/app/assets/javascripts/polymer/src/lib/expr/sinspect.html +235 -0
  29. data/app/assets/javascripts/polymer/src/lib/expr/style-auditor.html +123 -0
  30. data/app/assets/javascripts/polymer/src/lib/expr/style-protector.html +52 -0
  31. data/app/assets/javascripts/polymer/src/lib/gestures.html +284 -0
  32. data/app/assets/javascripts/polymer/src/lib/lang.html +21 -0
  33. data/app/assets/javascripts/polymer/src/lib/module.html +56 -0
  34. data/app/assets/javascripts/polymer/src/lib/polymer-bootstrap.html +78 -0
  35. data/app/assets/javascripts/polymer/src/lib/resolve-url.html +82 -0
  36. data/app/assets/javascripts/polymer/src/lib/settings.html +52 -0
  37. data/app/assets/javascripts/polymer/src/lib/style-defaults.html +32 -0
  38. data/app/assets/javascripts/polymer/src/lib/style-transformer.html +185 -0
  39. data/app/assets/javascripts/polymer/src/lib/style-util.html +77 -0
  40. data/app/assets/javascripts/polymer/src/lib/template/templatizer.html +132 -0
  41. data/app/assets/javascripts/polymer/src/lib/template/x-array-selector.html +178 -0
  42. data/app/assets/javascripts/polymer/src/lib/template/x-autobind.html +80 -0
  43. data/app/assets/javascripts/polymer/src/lib/template/x-if.html +115 -0
  44. data/app/assets/javascripts/polymer/src/lib/template/x-repeat.html +510 -0
  45. data/app/assets/javascripts/polymer/src/lib/template/x-template.html +39 -0
  46. data/app/assets/javascripts/polymer/src/lib/x-style.html +115 -0
  47. data/app/assets/javascripts/polymer/src/micro/attributes.html +180 -0
  48. data/app/assets/javascripts/polymer/src/micro/constructor.html +74 -0
  49. data/app/assets/javascripts/polymer/src/micro/extends.html +79 -0
  50. data/app/assets/javascripts/polymer/src/micro/mixins.html +40 -0
  51. data/app/assets/javascripts/polymer/src/micro/properties.html +96 -0
  52. data/app/assets/javascripts/polymer/src/micro/tag.html +28 -0
  53. data/app/assets/javascripts/polymer/src/mini/ready.html +180 -0
  54. data/app/assets/javascripts/polymer/src/mini/shadow.html +41 -0
  55. data/app/assets/javascripts/polymer/src/mini/shady.html +365 -0
  56. data/app/assets/javascripts/polymer/src/mini/template.html +56 -0
  57. data/app/assets/javascripts/polymer/src/polymer-lib.html +15 -0
  58. data/app/assets/javascripts/polymer/src/standard/annotations.html +198 -0
  59. data/app/assets/javascripts/polymer/src/standard/configure.html +160 -0
  60. data/app/assets/javascripts/polymer/src/standard/effects.html +215 -0
  61. data/app/assets/javascripts/polymer/src/standard/events.html +127 -0
  62. data/app/assets/javascripts/polymer/src/standard/notify-path.html +260 -0
  63. data/app/assets/javascripts/polymer/src/standard/resolveUrl.html +27 -0
  64. data/app/assets/javascripts/polymer/src/standard/styling.html +157 -0
  65. data/app/assets/javascripts/polymer/src/standard/utils.html +158 -0
  66. data/app/assets/javascripts/polymer/src/standard/x-styling.html +300 -0
  67. data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +2270 -0
  68. data/lib/generators/polymer/component/templates/component.html.erb +3 -3
  69. data/lib/generators/polymer/install/install_generator.rb +1 -1
  70. data/lib/polymer-rails/version.rb +1 -1
  71. metadata +80 -5
  72. data/app/assets/javascripts/polymer/layout.html +0 -286
  73. data/app/assets/javascripts/polymer/polymer.js +0 -14
  74. data/app/assets/javascripts/polymer/webcomponents.js +0 -14
@@ -0,0 +1,69 @@
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
+ <script>
11
+
12
+ Polymer.Debounce = (function() {
13
+
14
+ // usage
15
+
16
+ // invoke cb.call(this) in 100ms, unless the job is re-registered,
17
+ // which resets the timer
18
+ //
19
+ // this.job = this.debounce(this.job, cb, 100)
20
+ //
21
+ // returns a handle which can be used to re-register a job
22
+
23
+ var Async = Polymer.Async;
24
+
25
+ var Debouncer = function(context) {
26
+ this.context = context;
27
+ this.boundComplete = this.complete.bind(this);
28
+ };
29
+
30
+ Debouncer.prototype = {
31
+ go: function(callback, wait) {
32
+ var h;
33
+ this.finish = function() {
34
+ Async.cancel(h);
35
+ };
36
+ h = Async.run(this.boundComplete, wait);
37
+ this.callback = callback;
38
+ },
39
+ stop: function() {
40
+ if (this.finish) {
41
+ this.finish();
42
+ this.finish = null;
43
+ }
44
+ },
45
+ complete: function() {
46
+ if (this.finish) {
47
+ this.stop();
48
+ this.callback.call(this.context);
49
+ }
50
+ }
51
+ };
52
+
53
+ function debounce(debouncer, callback, wait) {
54
+ if (debouncer) {
55
+ debouncer.stop();
56
+ } else {
57
+ debouncer = new Debouncer(this);
58
+ }
59
+ debouncer.go(callback, wait);
60
+ return debouncer;
61
+ }
62
+
63
+ // exports
64
+
65
+ return debounce;
66
+
67
+ })();
68
+
69
+ </script>
@@ -0,0 +1,467 @@
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
+ <link rel="import" href="settings.html">
11
+ <link rel="import" href="event-api.html">
12
+ <script>
13
+
14
+ Polymer.DomApi = (function() {
15
+
16
+ var Debounce = Polymer.Debounce;
17
+ var Settings = Polymer.Settings;
18
+
19
+ var nativeInsertBefore = Element.prototype.insertBefore;
20
+ var nativeRemoveChild = Element.prototype.removeChild;
21
+ var nativeAppendChild = Element.prototype.appendChild;
22
+
23
+ var dirtyRoots = [];
24
+
25
+ var DomApi = function(node, patch) {
26
+ this.node = node;
27
+ if (patch) {
28
+ this.patch();
29
+ }
30
+ };
31
+
32
+ DomApi.prototype = {
33
+
34
+ // experimental: support patching selected native api.
35
+ patch: function() {
36
+ var self = this;
37
+ this.node.appendChild = function(node) {
38
+ return self.appendChild(node);
39
+ };
40
+ this.node.insertBefore = function(node, ref_node) {
41
+ return self.insertBefore(node, ref_node);
42
+ };
43
+ this.node.removeChild = function(node) {
44
+ return self.removeChild(node);
45
+ };
46
+ },
47
+
48
+ get childNodes() {
49
+ var c$ = getLightChildren(this.node);
50
+ return Array.isArray(c$) ? c$ : Array.prototype.slice.call(c$);
51
+ },
52
+
53
+ get children() {
54
+ return Array.prototype.filter.call(this.childNodes, function(n) {
55
+ return (n.nodeType === Node.ELEMENT_NODE);
56
+ });
57
+ },
58
+
59
+ get parentNode() {
60
+ return this.node.lightParent || this.node.parentNode;
61
+ },
62
+
63
+ flush: function() {
64
+ for (var i=0, host; i<dirtyRoots.length; i++) {
65
+ host = dirtyRoots[i];
66
+ if (host.__distribute) {
67
+ host.__distribute.complete();
68
+ }
69
+ }
70
+ dirtyRoots = [];
71
+ },
72
+
73
+ _lazyDistribute: function(host) {
74
+ if (host.shadyRoot) {
75
+ host.shadyRoot._distributionClean = false;
76
+ }
77
+ // TODO(sorvell): optimize debounce so it does less work by default
78
+ // and then remove these checks...
79
+ // need to dirty distribution once.
80
+ if (!host.__distribute || !host.__distribute.finish) {
81
+ host._debounce('__distribute', host._distributeContent);
82
+ dirtyRoots.push(host);
83
+ }
84
+ },
85
+
86
+ // cases in which we may not be able to just do standard appendChild
87
+ // 1. container has a shadyRoot (needsDistribution IFF the shadyRoot
88
+ // has an insertion point)
89
+ // 2. container is a shadyRoot (don't distribute, instead set
90
+ // container to container.host.
91
+ // 3. node is <content> (host of container needs distribution)
92
+ appendChild: function(node) {
93
+ var distributed;
94
+ if (node.lightParent) {
95
+ this._removeLogicalInfo(node, node.lightParent);
96
+ }
97
+ if (this._nodeIsInLogicalTree(this.node)) {
98
+ var host = this._hostForNode(this.node);
99
+ this._addLogicalInfo(node, this.node, host && host.shadyRoot);
100
+ if (host) {
101
+ host._elementAdd(node);
102
+ distributed = this._maybeDistribute(node, this.node, host);
103
+ }
104
+ }
105
+ if (!distributed) {
106
+ // if adding to a shadyRoot, add to host instead
107
+ var container = this.node._isShadyRoot ? this.node.host : this.node;
108
+ nativeAppendChild.call(container, node);
109
+ }
110
+ return node;
111
+ },
112
+
113
+ insertBefore: function(node, ref_node) {
114
+ if (!ref_node) {
115
+ return this.appendChild(node);
116
+ }
117
+ var distributed;
118
+ if (node.lightParent) {
119
+ this._removeLogicalInfo(node, node.lightParent);
120
+ }
121
+ if (this._nodeIsInLogicalTree(this.node)) {
122
+ saveLightChildrenIfNeeded(this.node);
123
+ var children = this.childNodes;
124
+ var index = children.indexOf(ref_node);
125
+ if (index < 0) {
126
+ throw Error('The ref_node to be inserted before is not a child ' +
127
+ 'of this node');
128
+ }
129
+ var host = this._hostForNode(this.node);
130
+ this._addLogicalInfo(node, this.node, host && host.shadyRoot, index);
131
+ if (host) {
132
+ host._elementAdd(node);
133
+ distributed = this._maybeDistribute(node, this.node, host);
134
+ }
135
+ }
136
+ if (!distributed) {
137
+ // if ref_node is <content> replace with first distributed node
138
+ ref_node = ref_node.localName === CONTENT ?
139
+ this._firstComposedNode(ref_node) : ref_node;
140
+ // if adding to a shadyRoot, add to host instead
141
+ var container = this.node._isShadyRoot ? this.node.host : this.node;
142
+ nativeInsertBefore.call(container, node, ref_node);
143
+ }
144
+ return node;
145
+ },
146
+
147
+ /**
148
+ Removes the given `node` from the element's `lightChildren`.
149
+ This method also performs dom composition.
150
+ */
151
+ removeChild: function(node) {
152
+ var distributed;
153
+ if (this._nodeIsInLogicalTree(this.node)) {
154
+ var host = this._hostForNode(this.node);
155
+ this._removeLogicalInfo(node, this.node);
156
+ if (host) {
157
+ host._elementRemove(node);
158
+ distributed = this._maybeDistribute(node, this.node, host);
159
+ }
160
+ }
161
+ if (!distributed) {
162
+ // if removing from a shadyRoot, remove form host instead
163
+ var container = this.node._isShadyRoot ? this.node.host : this.node;
164
+ nativeRemoveChild.call(container, node);
165
+ }
166
+ },
167
+
168
+ replaceChild: function(node, ref_node) {
169
+ this.insertBefore(node, ref_node);
170
+ this.removeChild(ref_node);
171
+ },
172
+
173
+ _getOwnerShadyRoot: function() {
174
+ return this._ownerShadyRootForNode(this.node);
175
+ },
176
+
177
+ getOwnerRoot: function() {
178
+ return this._getOwnerShadyRoot();
179
+ },
180
+
181
+ _ownerShadyRootForNode: function(node) {
182
+ if (node._ownerShadyRoot === undefined) {
183
+ var root;
184
+ if (node._isShadyRoot) {
185
+ root = node;
186
+ } else {
187
+ var parent = Polymer.dom(node).parentNode;
188
+ if (parent) {
189
+ root = parent._isShadyRoot ? parent :
190
+ this._ownerShadyRootForNode(parent);
191
+ } else {
192
+ root = null;
193
+ }
194
+ }
195
+ node._ownerShadyRoot = root;
196
+ }
197
+ return node._ownerShadyRoot;
198
+
199
+ },
200
+
201
+ _maybeDistribute: function(node, parent, host) {
202
+ var nodeNeedsDistribute = this._nodeNeedsDistribution(node);
203
+ var distribute = this._parentNeedsDistribution(parent) ||
204
+ nodeNeedsDistribute;
205
+ if (nodeNeedsDistribute) {
206
+ this._updateInsertionPoints(host);
207
+ }
208
+ if (distribute) {
209
+ this._lazyDistribute(host);
210
+ }
211
+ return distribute;
212
+ },
213
+
214
+ _updateInsertionPoints: function(host) {
215
+ host.shadyRoot._insertionPoints =
216
+ factory(host.shadyRoot).querySelectorAll(CONTENT);
217
+ },
218
+
219
+ _nodeIsInLogicalTree: function(node) {
220
+ return Boolean(node._isShadyRoot ||
221
+ this._getOwnerShadyRoot(node) ||
222
+ node.shadyRoot);
223
+ },
224
+
225
+ _hostForNode: function(node) {
226
+ var root = node.shadyRoot || (node._isShadyRoot ?
227
+ node : this._getOwnerShadyRoot(node));
228
+ return root && root.host;
229
+ },
230
+
231
+ _parentNeedsDistribution: function(parent) {
232
+ return parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
233
+ },
234
+
235
+ // TODO(sorvell): technically we should check non-fragment nodes for
236
+ // <content> children but since this case is assumed to be exceedingly
237
+ // rare, we avoid the cost and will address with some specific api
238
+ // when the need arises.
239
+ _nodeNeedsDistribution: function(node) {
240
+ return (node.localName === CONTENT) ||
241
+ ((node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) &&
242
+ node.querySelector(CONTENT));
243
+ },
244
+
245
+ _addLogicalInfo: function(node, container, root, index) {
246
+ saveLightChildrenIfNeeded(container);
247
+ var children = factory(container).childNodes;
248
+ index = index === undefined ? children.length : index;
249
+ // handle document fragments
250
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
251
+ var n = node.firstChild;
252
+ while (n) {
253
+ children.splice(index++, 0, n);
254
+ n.lightParent = container;
255
+ n = n.nextSibling;
256
+ }
257
+ } else {
258
+ children.splice(index, 0, node);
259
+ node.lightParent = container;
260
+ node._ownerShadyRoot = root;
261
+ }
262
+ // TODO(sorvell): consider not attaching this to every node and instead
263
+ // looking up the tree for this info.
264
+ // add _ownerShadyRoot info
265
+ var c$ = factory(node).childNodes;
266
+ if (c$.length) {
267
+ this._addRootToChildren(node, root);
268
+ }
269
+ },
270
+
271
+ // NOTE: in general, we expect contents of the lists here to be small-ish
272
+ // and therefore indexOf to be nbd. Other optimizations can be made
273
+ // for larger lists (linked list)
274
+ _removeLogicalInfo: function(node, container) {
275
+ var children = factory(container).childNodes;
276
+ var index = children.indexOf(node);
277
+ if ((index < 0) || (container !== node.lightParent)) {
278
+ throw Error('The node to be removed is not a child of this node');
279
+ }
280
+ children.splice(index, 1);
281
+ node.lightParent = null;
282
+ // TODO(sorvell): need to clear any children of element?
283
+ node._ownerShadyRoot = undefined;
284
+ },
285
+
286
+ _addRootToChildren: function(children, root) {
287
+ for (var i=0, l=children.length, c, cc; (i<l) && (c=children[i]); i++) {
288
+ c._ownerShadyRoot = root;
289
+ cc = factory(c).childNodes;
290
+ if (cc.length) {
291
+ this._addRootToChildren(cc, root);
292
+ }
293
+ }
294
+ },
295
+
296
+ // TODO(sorvell): This will fail if distribution that affects this
297
+ // question is pending; this is expected to be exceedingly rare, but if
298
+ // the issue comes up, we can force a flush in this case.
299
+ _firstComposedNode: function(content) {
300
+ var n$ = factory(content).getDistributedNodes();
301
+ for (var i=0, l=n$.length, n, p$; (i<l) && (n=n$[i]); i++) {
302
+ p$ = factory(n).getDestinationInsertionPoints();
303
+ // means that we're composed to this spot.
304
+ if (p$[p$.length-1] === content) {
305
+ return n;
306
+ }
307
+ }
308
+ },
309
+
310
+ // TODO(sorvell): consider doing native QSA and filtering results.
311
+ querySelector: function(selector) {
312
+ return this.querySelectorAll(selector)[0];
313
+ },
314
+
315
+ querySelectorAll: function(selector) {
316
+ return this._query(function(n) {
317
+ return matchesSelector.call(n, selector);
318
+ }, this.node);
319
+ },
320
+
321
+ _query: function(matcher, node) {
322
+ var list = [];
323
+ this._queryElements(factory(node).childNodes, matcher, list);
324
+ return list;
325
+ },
326
+
327
+ _queryElements: function(elements, matcher, list) {
328
+ for (var i=0, l=elements.length, c; (i<l) && (c=elements[i]); i++) {
329
+ if (c.nodeType === Node.ELEMENT_NODE) {
330
+ this._queryElement(c, matcher, list);
331
+ }
332
+ }
333
+ },
334
+
335
+ _queryElement: function(node, matcher, list) {
336
+ if (matcher(node)) {
337
+ list.push(node);
338
+ }
339
+ this._queryElements(factory(node).childNodes, matcher, list);
340
+ },
341
+
342
+ getDestinationInsertionPoints: function() {
343
+ return this.node._destinationInsertionPoints ||
344
+ Array.prototype.slice.call(this.node.getDestinationInsertionPoints());
345
+ },
346
+
347
+ getDistributedNodes: function() {
348
+ return this.node._distributedNodes ||
349
+ Array.prototype.slice.call(this.node.getDistributedNodes());
350
+ },
351
+
352
+ /*
353
+ Returns a list of nodes distributed within this element. These can be
354
+ dom children or elements distributed to children that are insertion
355
+ points.
356
+ */
357
+ queryDistributedElements: function(selector) {
358
+ var c$ = this.childNodes;
359
+ var list = [];
360
+ this._distributedFilter(selector, c$, list);
361
+ for (var i=0, l=c$.length, c; (i<l) && (c=c$[i]); i++) {
362
+ if (c.localName === CONTENT) {
363
+ this._distributedFilter(selector, factory(c).getDistributedNodes(),
364
+ list);
365
+ }
366
+ }
367
+ return list;
368
+ },
369
+
370
+ _distributedFilter: function(selector, list, results) {
371
+ results = results || [];
372
+ for (var i=0, l=list.length, d; (i<l) && (d=list[i]); i++) {
373
+ if ((d.nodeType === Node.ELEMENT_NODE) &&
374
+ (d.localName !== CONTENT) &&
375
+ matchesSelector.call(d, selector)) {
376
+ results.push(d);
377
+ }
378
+ }
379
+ return results;
380
+ }
381
+
382
+ };
383
+
384
+ if (Settings.useShadow) {
385
+
386
+ DomApi.prototype.querySelectorAll = function(selector) {
387
+ return Array.prototype.slice.call(this.node.querySelectorAll(selector));
388
+ };
389
+
390
+ DomApi.prototype.patch = function() {};
391
+
392
+ DomApi.prototype.getOwnerRoot = function() {
393
+ var n = this.node;
394
+ while (n) {
395
+ if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host) {
396
+ return n;
397
+ }
398
+ n = n.parentNode;
399
+ }
400
+ };
401
+
402
+ }
403
+
404
+ var CONTENT = 'content';
405
+
406
+ var factory = function(node, patch) {
407
+ node = node || document;
408
+ if (!node.__domApi) {
409
+ node.__domApi = new DomApi(node, patch);
410
+ }
411
+ return node.__domApi;
412
+ };
413
+
414
+ Polymer.dom = function(obj, patch) {
415
+ if (obj instanceof Event) {
416
+ return Polymer.EventApi.factory(obj);
417
+ } else {
418
+ return factory(obj, patch);
419
+ }
420
+ };
421
+
422
+ // make flush available directly.
423
+ Polymer.dom.flush = DomApi.prototype.flush;
424
+
425
+ function getLightChildren(node) {
426
+ var children = node.lightChildren;
427
+ return children ? children : node.childNodes;
428
+ }
429
+
430
+ function saveLightChildrenIfNeeded(node) {
431
+ // Capture the list of light children. It's important to do this before we
432
+ // start transforming the DOM into "rendered" state.
433
+ //
434
+ // Children may be added to this list dynamically. It will be treated as the
435
+ // source of truth for the light children of the element. This element's
436
+ // actual children will be treated as the rendered state once lightChildren
437
+ // is populated.
438
+ if (!node.lightChildren) {
439
+ var children = [];
440
+ for (var child = node.firstChild; child; child = child.nextSibling) {
441
+ children.push(child);
442
+ child.lightParent = child.lightParent || node;
443
+ }
444
+ node.lightChildren = children;
445
+ }
446
+ }
447
+
448
+ function hasInsertionPoint(root) {
449
+ return Boolean(root._insertionPoints.length);
450
+ }
451
+
452
+ var p = Element.prototype;
453
+ var matchesSelector = p.matches || p.matchesSelector ||
454
+ p.mozMatchesSelector || p.msMatchesSelector ||
455
+ p.oMatchesSelector || p.webkitMatchesSelector;
456
+
457
+ return {
458
+ getLightChildren: getLightChildren,
459
+ saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
460
+ matchesSelector: matchesSelector,
461
+ hasInsertionPoint: hasInsertionPoint,
462
+ factory: factory
463
+ };
464
+
465
+ })();
466
+
467
+ </script>