polymer-rails 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -8
- data/app/assets/javascripts/polymer/polymer-micro.html +1 -1
- data/app/assets/javascripts/polymer/polymer-mini.html +86 -58
- data/app/assets/javascripts/polymer/polymer.html +201 -72
- data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +39 -25
- data/app/assets/javascripts/webcomponentsjs/webcomponents.js +39 -25
- data/lib/generators/polymer/component/templates/component.js.erb +2 -2
- data/lib/polymer-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d172b9731e66e8ede28d16419e23ed0f333e1a38
|
4
|
+
data.tar.gz: cf721f1ab30458b086ec02a04ca5ad5ed8d16b22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dff092d07bb8de17f252e9351208c1705cbd9fb68902099cc959e071e64b4b4394b4c8dfee710d6e8f6d8a7b082f95e8f25c1f3a9fdffa113a8142c0b59a22b
|
7
|
+
data.tar.gz: 69eae6d64d6518cab48f65463746c7b04223a998a16811442cdd994e1d995bc2d260a57c73a384bbab6e70b1e6a3e6075b892c0a35e06749fe7ff0e4d812dab1
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Polymer-Rails
|
2
|
-
Want to get started with [web components](http://www.w3.org/wiki/WebComponents/)? Want to bring them into your Rails app? Easily build your own and use web components that are built by community in your Ruby on Rails Application.
|
2
|
+
Want to get started with [web components](http://www.w3.org/wiki/WebComponents/)? Want to bring them into your Rails app? Easily build your own and use web components that are built by community in your Ruby on Rails Application. Polymer-rails helps you to do this:
|
3
3
|
|
4
4
|
1. Adds [polymer](http://polymer-project.org/) library to assets of your rails project.
|
5
5
|
|
@@ -16,15 +16,12 @@ This assets will be automatically compiled and required into component html file
|
|
16
16
|
|
17
17
|
|
18
18
|
## Versions
|
19
|
-
|
19
|
+
Polymer 1.0 is out!
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
0.8.x release is not compatible with the 0.5 APIs. For guidance on migrating an existing 0.5 element to the 0.8 APIs, see the [Migration guide](https://www.polymer-project.org/0.8/docs/migration.html).
|
24
|
-
|
25
|
-
* `0.2.x` Releases include Polymer versions `0.5.x`
|
26
|
-
* `0.3.x` Releases include Polymer versions `0.8.x`
|
21
|
+
* Use `0.2.x` versions of `polymer-rails` to work with Polymer versions `0.5.x`
|
22
|
+
* Use `1.0.x` versions of `polymer-rails` to work with Polymer versions `1.0.x`
|
27
23
|
|
24
|
+
1.0 release is not compatible with the 0.5 APIs. For guidance on migrating an existing 0.5 elements to the 1.0 APIs, see the [Migration guide](https://www.polymer-project.org/1.0/docs/migration.html).
|
28
25
|
|
29
26
|
## Installation
|
30
27
|
|
@@ -11,13 +11,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
11
11
|
<script>Polymer.Base._addFeature({
|
12
12
|
_prepTemplate: function () {
|
13
13
|
this._template = this._template || Polymer.DomModule.import(this.is, 'template');
|
14
|
-
if (!this._template) {
|
15
|
-
var script = document._currentScript || document.currentScript;
|
16
|
-
var prev = script && script.previousElementSibling;
|
17
|
-
if (prev && prev.localName === 'template') {
|
18
|
-
this._template = prev;
|
19
|
-
}
|
20
|
-
}
|
21
14
|
if (this._template && this._template.hasAttribute('is')) {
|
22
15
|
this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
|
23
16
|
}
|
@@ -456,20 +449,17 @@ dirtyRoots.push(host);
|
|
456
449
|
}
|
457
450
|
},
|
458
451
|
appendChild: function (node) {
|
459
|
-
var
|
460
|
-
this._removeNodeFromHost(node);
|
452
|
+
var handled;
|
453
|
+
this._removeNodeFromHost(node, true);
|
461
454
|
if (this._nodeIsInLogicalTree(this.node)) {
|
462
|
-
|
463
|
-
this._addLogicalInfo(node, this.node, host && host.shadyRoot);
|
455
|
+
this._addLogicalInfo(node, this.node);
|
464
456
|
this._addNodeToHost(node);
|
465
|
-
|
466
|
-
distributed = this._maybeDistribute(node, this.node, host);
|
457
|
+
handled = this._maybeDistribute(node, this.node);
|
467
458
|
}
|
468
|
-
|
469
|
-
if (!distributed && !this._tryRemoveUndistributedNode(node)) {
|
459
|
+
if (!handled && !this._tryRemoveUndistributedNode(node)) {
|
470
460
|
var container = this.node._isShadyRoot ? this.node.host : this.node;
|
471
|
-
nativeAppendChild.call(container, node);
|
472
461
|
addToComposedParent(container, node);
|
462
|
+
nativeAppendChild.call(container, node);
|
473
463
|
}
|
474
464
|
return node;
|
475
465
|
},
|
@@ -477,8 +467,8 @@ insertBefore: function (node, ref_node) {
|
|
477
467
|
if (!ref_node) {
|
478
468
|
return this.appendChild(node);
|
479
469
|
}
|
480
|
-
var
|
481
|
-
this._removeNodeFromHost(node);
|
470
|
+
var handled;
|
471
|
+
this._removeNodeFromHost(node, true);
|
482
472
|
if (this._nodeIsInLogicalTree(this.node)) {
|
483
473
|
saveLightChildrenIfNeeded(this.node);
|
484
474
|
var children = this.childNodes;
|
@@ -486,18 +476,15 @@ var index = children.indexOf(ref_node);
|
|
486
476
|
if (index < 0) {
|
487
477
|
throw Error('The ref_node to be inserted before is not a child ' + 'of this node');
|
488
478
|
}
|
489
|
-
|
490
|
-
this._addLogicalInfo(node, this.node, host && host.shadyRoot, index);
|
479
|
+
this._addLogicalInfo(node, this.node, index);
|
491
480
|
this._addNodeToHost(node);
|
492
|
-
|
493
|
-
distributed = this._maybeDistribute(node, this.node, host);
|
494
|
-
}
|
481
|
+
handled = this._maybeDistribute(node, this.node);
|
495
482
|
}
|
496
|
-
if (!
|
483
|
+
if (!handled && !this._tryRemoveUndistributedNode(node)) {
|
497
484
|
ref_node = ref_node.localName === CONTENT ? this._firstComposedNode(ref_node) : ref_node;
|
498
485
|
var container = this.node._isShadyRoot ? this.node.host : this.node;
|
499
|
-
nativeInsertBefore.call(container, node, ref_node);
|
500
486
|
addToComposedParent(container, node, ref_node);
|
487
|
+
nativeInsertBefore.call(container, node, ref_node);
|
501
488
|
}
|
502
489
|
return node;
|
503
490
|
},
|
@@ -505,17 +492,16 @@ removeChild: function (node) {
|
|
505
492
|
if (factory(node).parentNode !== this.node) {
|
506
493
|
console.warn('The node to be removed is not a child of this node', node);
|
507
494
|
}
|
508
|
-
var
|
495
|
+
var handled;
|
509
496
|
if (this._nodeIsInLogicalTree(this.node)) {
|
510
|
-
var host = this._hostForNode(this.node);
|
511
|
-
distributed = this._maybeDistribute(node, this.node, host);
|
512
497
|
this._removeNodeFromHost(node);
|
498
|
+
handled = this._maybeDistribute(node, this.node);
|
513
499
|
}
|
514
|
-
if (!
|
500
|
+
if (!handled) {
|
515
501
|
var container = this.node._isShadyRoot ? this.node.host : this.node;
|
516
502
|
if (container === node.parentNode) {
|
517
|
-
nativeRemoveChild.call(container, node);
|
518
503
|
removeFromComposedParent(container, node);
|
504
|
+
nativeRemoveChild.call(container, node);
|
519
505
|
}
|
520
506
|
}
|
521
507
|
return node;
|
@@ -548,16 +534,23 @@ node._ownerShadyRoot = root;
|
|
548
534
|
}
|
549
535
|
return node._ownerShadyRoot;
|
550
536
|
},
|
551
|
-
_maybeDistribute: function (node, parent
|
552
|
-
var
|
553
|
-
var
|
554
|
-
|
537
|
+
_maybeDistribute: function (node, parent) {
|
538
|
+
var fragContent = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && node.querySelector(CONTENT);
|
539
|
+
var wrappedContent = fragContent && fragContent.parentNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE;
|
540
|
+
var hasContent = fragContent || node.localName === CONTENT;
|
541
|
+
if (hasContent) {
|
542
|
+
var root = this._ownerShadyRootForNode(parent);
|
543
|
+
if (root) {
|
544
|
+
var host = root.host;
|
555
545
|
this._updateInsertionPoints(host);
|
556
|
-
}
|
557
|
-
if (distribute) {
|
558
546
|
this._lazyDistribute(host);
|
559
547
|
}
|
560
|
-
|
548
|
+
}
|
549
|
+
var parentNeedsDist = this._parentNeedsDistribution(parent);
|
550
|
+
if (parentNeedsDist) {
|
551
|
+
this._lazyDistribute(parent);
|
552
|
+
}
|
553
|
+
return parentNeedsDist || hasContent && !wrappedContent;
|
561
554
|
},
|
562
555
|
_tryRemoveUndistributedNode: function (node) {
|
563
556
|
if (this.node.shadyRoot) {
|
@@ -573,25 +566,56 @@ host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTE
|
|
573
566
|
_nodeIsInLogicalTree: function (node) {
|
574
567
|
return Boolean(node._lightParent || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
|
575
568
|
},
|
576
|
-
_hostForNode: function (node) {
|
577
|
-
var root = node.shadyRoot || (node._isShadyRoot ? node : this._ownerShadyRootForNode(node));
|
578
|
-
return root && root.host;
|
579
|
-
},
|
580
569
|
_parentNeedsDistribution: function (parent) {
|
581
570
|
return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
|
582
571
|
},
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
if (
|
588
|
-
|
572
|
+
_removeNodeFromHost: function (node, ensureComposedRemoval) {
|
573
|
+
var hostNeedsDist;
|
574
|
+
var root;
|
575
|
+
var parent = node._lightParent;
|
576
|
+
if (parent) {
|
577
|
+
root = this._ownerShadyRootForNode(node);
|
589
578
|
if (root) {
|
590
579
|
root.host._elementRemove(node);
|
580
|
+
hostNeedsDist = this._removeDistributedChildren(root, node);
|
591
581
|
}
|
592
582
|
this._removeLogicalInfo(node, node._lightParent);
|
593
583
|
}
|
594
584
|
this._removeOwnerShadyRoot(node);
|
585
|
+
if (root && hostNeedsDist) {
|
586
|
+
this._updateInsertionPoints(root.host);
|
587
|
+
this._lazyDistribute(root.host);
|
588
|
+
} else if (ensureComposedRemoval) {
|
589
|
+
removeFromComposedParent(parent || node.parentNode, node);
|
590
|
+
}
|
591
|
+
},
|
592
|
+
_removeDistributedChildren: function (root, container) {
|
593
|
+
var hostNeedsDist;
|
594
|
+
var ip$ = root._insertionPoints;
|
595
|
+
for (var i = 0; i < ip$.length; i++) {
|
596
|
+
var content = ip$[i];
|
597
|
+
if (this._contains(container, content)) {
|
598
|
+
var dc$ = factory(content).getDistributedNodes();
|
599
|
+
for (var j = 0; j < dc$.length; j++) {
|
600
|
+
hostNeedsDist = true;
|
601
|
+
var node = dc$[i];
|
602
|
+
var parent = node.parentNode;
|
603
|
+
if (parent) {
|
604
|
+
removeFromComposedParent(parent, node);
|
605
|
+
nativeRemoveChild.call(parent, node);
|
606
|
+
}
|
607
|
+
}
|
608
|
+
}
|
609
|
+
}
|
610
|
+
return hostNeedsDist;
|
611
|
+
},
|
612
|
+
_contains: function (container, node) {
|
613
|
+
while (node) {
|
614
|
+
if (node == container) {
|
615
|
+
return true;
|
616
|
+
}
|
617
|
+
node = factory(node).parentNode;
|
618
|
+
}
|
595
619
|
},
|
596
620
|
_addNodeToHost: function (node) {
|
597
621
|
var checkNode = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? node.firstChild : node;
|
@@ -600,7 +624,7 @@ if (root) {
|
|
600
624
|
root.host._elementAdd(node);
|
601
625
|
}
|
602
626
|
},
|
603
|
-
_addLogicalInfo: function (node, container,
|
627
|
+
_addLogicalInfo: function (node, container, index) {
|
604
628
|
saveLightChildrenIfNeeded(container);
|
605
629
|
var children = factory(container).childNodes;
|
606
630
|
index = index === undefined ? children.length : index;
|
@@ -975,20 +999,17 @@ var children = getComposedChildren(parent);
|
|
975
999
|
var i = ref_node ? children.indexOf(ref_node) : -1;
|
976
1000
|
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
977
1001
|
var fragChildren = getComposedChildren(node);
|
978
|
-
fragChildren.
|
979
|
-
addNodeToComposedChildren(
|
980
|
-
}
|
1002
|
+
for (var j = 0; j < fragChildren.length; j++) {
|
1003
|
+
addNodeToComposedChildren(fragChildren[j], parent, children, i + j);
|
1004
|
+
}
|
1005
|
+
node._composedChildren = null;
|
981
1006
|
} else {
|
982
1007
|
addNodeToComposedChildren(node, parent, children, i);
|
983
1008
|
}
|
984
1009
|
}
|
985
1010
|
function addNodeToComposedChildren(node, parent, children, i) {
|
986
1011
|
node._composedParent = parent;
|
987
|
-
|
988
|
-
children.splice(i, 0, node);
|
989
|
-
} else {
|
990
|
-
children.push(node);
|
991
|
-
}
|
1012
|
+
children.splice(i >= 0 ? i : children.length, 0, node);
|
992
1013
|
}
|
993
1014
|
function removeFromComposedParent(parent, node) {
|
994
1015
|
node._composedParent = null;
|
@@ -1059,10 +1080,14 @@ get domHost() {
|
|
1059
1080
|
var root = Polymer.dom(this).getOwnerRoot();
|
1060
1081
|
return root && root.host;
|
1061
1082
|
},
|
1062
|
-
distributeContent: function () {
|
1083
|
+
distributeContent: function (updateInsertionPoints) {
|
1063
1084
|
if (this.shadyRoot) {
|
1085
|
+
var dom = Polymer.dom(this);
|
1086
|
+
if (updateInsertionPoints) {
|
1087
|
+
dom._updateInsertionPoints(this);
|
1088
|
+
}
|
1064
1089
|
var host = getTopDistributingHost(this);
|
1065
|
-
|
1090
|
+
dom._lazyDistribute(host);
|
1066
1091
|
}
|
1067
1092
|
},
|
1068
1093
|
_distributeContent: function () {
|
@@ -1092,6 +1117,7 @@ this._composeTree();
|
|
1092
1117
|
} else {
|
1093
1118
|
if (!this.shadyRoot._hasDistributed) {
|
1094
1119
|
this.textContent = '';
|
1120
|
+
this._composedChildren = null;
|
1095
1121
|
this.appendChild(this.shadyRoot);
|
1096
1122
|
} else {
|
1097
1123
|
var children = this._composeNode(this);
|
@@ -1251,6 +1277,7 @@ points.push(insertionPoint);
|
|
1251
1277
|
}
|
1252
1278
|
function clearDistributedDestinationInsertionPoints(content) {
|
1253
1279
|
var e$ = content._distributedNodes;
|
1280
|
+
if (e$) {
|
1254
1281
|
for (var i = 0; i < e$.length; i++) {
|
1255
1282
|
var d = e$[i]._destinationInsertionPoints;
|
1256
1283
|
if (d) {
|
@@ -1258,6 +1285,7 @@ d.splice(d.indexOf(content) + 1, d.length);
|
|
1258
1285
|
}
|
1259
1286
|
}
|
1260
1287
|
}
|
1288
|
+
}
|
1261
1289
|
function maybeRedistributeParent(content, host) {
|
1262
1290
|
var parent = content._lightParent;
|
1263
1291
|
if (parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot) && parent.shadyRoot._distributionClean) {
|
@@ -181,6 +181,9 @@ at.value = a === 'style' ? resolveCss(v, ownerDocument) : resolve(v, ownerDocume
|
|
181
181
|
}
|
182
182
|
}
|
183
183
|
function resolve(url, ownerDocument) {
|
184
|
+
if (url && url[0] === '#') {
|
185
|
+
return url;
|
186
|
+
}
|
184
187
|
var resolver = getUrlResolver(ownerDocument);
|
185
188
|
resolver.href = url;
|
186
189
|
return resolver.href || url;
|
@@ -341,18 +344,57 @@ this.listen(node, name, listeners[key]);
|
|
341
344
|
listen: function (node, eventName, methodName) {
|
342
345
|
this._listen(node, eventName, this._createEventHandler(node, eventName, methodName));
|
343
346
|
},
|
347
|
+
_boundListenerKey: function (eventName, methodName) {
|
348
|
+
return eventName + ':' + methodName;
|
349
|
+
},
|
350
|
+
_recordEventHandler: function (host, eventName, target, methodName, handler) {
|
351
|
+
var hbl = host.__boundListeners;
|
352
|
+
if (!hbl) {
|
353
|
+
hbl = host.__boundListeners = new WeakMap();
|
354
|
+
}
|
355
|
+
var bl = hbl.get(target);
|
356
|
+
if (!bl) {
|
357
|
+
bl = {};
|
358
|
+
hbl.set(target, bl);
|
359
|
+
}
|
360
|
+
var key = this._boundListenerKey(eventName, methodName);
|
361
|
+
bl[key] = handler;
|
362
|
+
},
|
363
|
+
_recallEventHandler: function (host, eventName, target, methodName) {
|
364
|
+
var hbl = host.__boundListeners;
|
365
|
+
if (!hbl) {
|
366
|
+
return;
|
367
|
+
}
|
368
|
+
var bl = hbl.get(target);
|
369
|
+
if (!bl) {
|
370
|
+
return;
|
371
|
+
}
|
372
|
+
var key = this._boundListenerKey(eventName, methodName);
|
373
|
+
return bl[key];
|
374
|
+
},
|
344
375
|
_createEventHandler: function (node, eventName, methodName) {
|
345
376
|
var host = this;
|
346
|
-
|
377
|
+
var handler = function (e) {
|
347
378
|
if (host[methodName]) {
|
348
379
|
host[methodName](e, e.detail);
|
349
380
|
} else {
|
350
381
|
host._warn(host._logf('_createEventHandler', 'listener method `' + methodName + '` not defined'));
|
351
382
|
}
|
352
383
|
};
|
384
|
+
this._recordEventHandler(host, eventName, node, methodName, handler);
|
385
|
+
return handler;
|
386
|
+
},
|
387
|
+
unlisten: function (node, eventName, methodName) {
|
388
|
+
var handler = this._recallEventHandler(this, eventName, node, methodName);
|
389
|
+
if (handler) {
|
390
|
+
this._unlisten(node, eventName, handler);
|
391
|
+
}
|
353
392
|
},
|
354
393
|
_listen: function (node, eventName, handler) {
|
355
394
|
node.addEventListener(eventName, handler);
|
395
|
+
},
|
396
|
+
_unlisten: function (node, eventName, handler) {
|
397
|
+
node.removeEventListener(eventName, handler);
|
356
398
|
}
|
357
399
|
});
|
358
400
|
(function () {
|
@@ -406,7 +448,6 @@ POINTERSTATE.mouse.mouseIgnoreJob = null;
|
|
406
448
|
POINTERSTATE.mouse.mouseIgnoreJob = Polymer.Debounce(POINTERSTATE.mouse.mouseIgnoreJob, unset, MOUSE_TIMEOUT);
|
407
449
|
}
|
408
450
|
var POINTERSTATE = {
|
409
|
-
tapPrevented: false,
|
410
451
|
mouse: {
|
411
452
|
target: null,
|
412
453
|
mouseIgnoreJob: null
|
@@ -540,12 +581,43 @@ if (recognizer.touchAction) {
|
|
540
581
|
this.setTouchAction(node, recognizer.touchAction);
|
541
582
|
}
|
542
583
|
},
|
584
|
+
remove: function (node, evType, handler) {
|
585
|
+
var recognizer = this.gestures[evType];
|
586
|
+
var deps = recognizer.deps;
|
587
|
+
var name = recognizer.name;
|
588
|
+
var gobj = node[GESTURE_KEY];
|
589
|
+
if (gobj) {
|
590
|
+
for (var i = 0, dep, gd; i < deps.length; i++) {
|
591
|
+
dep = deps[i];
|
592
|
+
gd = gobj[dep];
|
593
|
+
if (gd && gd[name]) {
|
594
|
+
gd[name] = (gd[name] || 1) - 1;
|
595
|
+
if (gd[name] === 0) {
|
596
|
+
node.removeEventListener(dep, this.handleNative);
|
597
|
+
}
|
598
|
+
}
|
599
|
+
}
|
600
|
+
}
|
601
|
+
node.removeEventListener(evType, handler);
|
602
|
+
},
|
543
603
|
register: function (recog) {
|
544
604
|
this.recognizers.push(recog);
|
545
605
|
for (var i = 0; i < recog.emits.length; i++) {
|
546
606
|
this.gestures[recog.emits[i]] = recog;
|
547
607
|
}
|
548
608
|
},
|
609
|
+
findRecognizerByEvent: function (evName) {
|
610
|
+
for (var i = 0, r; i < this.recognizers.length; i++) {
|
611
|
+
r = this.recognizers[i];
|
612
|
+
for (var j = 0, n; j < r.emits.length; j++) {
|
613
|
+
n = r.emits[j];
|
614
|
+
if (n === evName) {
|
615
|
+
return r;
|
616
|
+
}
|
617
|
+
}
|
618
|
+
}
|
619
|
+
return null;
|
620
|
+
},
|
549
621
|
setTouchAction: function (node, value) {
|
550
622
|
if (HAS_NATIVE_TA) {
|
551
623
|
node.style.touchAction = value;
|
@@ -553,12 +625,23 @@ node.style.touchAction = value;
|
|
553
625
|
node[TOUCH_ACTION] = value;
|
554
626
|
},
|
555
627
|
fire: function (target, type, detail) {
|
556
|
-
var ev =
|
557
|
-
|
628
|
+
var ev = Polymer.Base.fire(type, detail, {
|
629
|
+
node: target,
|
558
630
|
bubbles: true,
|
559
631
|
cancelable: true
|
560
632
|
});
|
561
|
-
|
633
|
+
if (ev.defaultPrevented) {
|
634
|
+
var se = detail.sourceEvent;
|
635
|
+
if (se && se.preventDefault) {
|
636
|
+
se.preventDefault();
|
637
|
+
}
|
638
|
+
}
|
639
|
+
},
|
640
|
+
prevent: function (evName) {
|
641
|
+
var recognizer = this.findRecognizerByEvent(evName);
|
642
|
+
if (recognizer.info) {
|
643
|
+
recognizer.info.prevent = true;
|
644
|
+
}
|
562
645
|
}
|
563
646
|
};
|
564
647
|
Gestures.register({
|
@@ -589,10 +672,12 @@ touchend: function (e) {
|
|
589
672
|
this.fire('up', e.currentTarget, e.changedTouches[0]);
|
590
673
|
},
|
591
674
|
fire: function (type, target, event) {
|
675
|
+
var self = this;
|
592
676
|
Gestures.fire(target, type, {
|
593
677
|
x: event.clientX,
|
594
678
|
y: event.clientY,
|
595
|
-
sourceEvent: event
|
679
|
+
sourceEvent: event,
|
680
|
+
prevent: Gestures.prevent.bind(Gestures)
|
596
681
|
});
|
597
682
|
}
|
598
683
|
});
|
@@ -617,7 +702,8 @@ if (this.moves.length > TRACK_LENGTH) {
|
|
617
702
|
this.moves.shift();
|
618
703
|
}
|
619
704
|
this.moves.push(move);
|
620
|
-
}
|
705
|
+
},
|
706
|
+
prevent: false
|
621
707
|
},
|
622
708
|
clearInfo: function () {
|
623
709
|
this.info.state = 'start';
|
@@ -625,8 +711,12 @@ this.info.started = false;
|
|
625
711
|
this.info.moves = [];
|
626
712
|
this.info.x = 0;
|
627
713
|
this.info.y = 0;
|
714
|
+
this.info.prevent = false;
|
628
715
|
},
|
629
716
|
hasMovedEnough: function (x, y) {
|
717
|
+
if (this.info.prevent) {
|
718
|
+
return false;
|
719
|
+
}
|
630
720
|
if (this.info.started) {
|
631
721
|
return true;
|
632
722
|
}
|
@@ -646,13 +736,12 @@ x: x,
|
|
646
736
|
y: y
|
647
737
|
});
|
648
738
|
self.fire(t, e);
|
649
|
-
e.preventDefault();
|
650
739
|
self.info.started = true;
|
651
740
|
}
|
652
741
|
};
|
653
742
|
var upfn = function upfn(e) {
|
654
743
|
if (self.info.started) {
|
655
|
-
|
744
|
+
Gestures.prevent('tap');
|
656
745
|
movefn(e);
|
657
746
|
}
|
658
747
|
self.clearInfo();
|
@@ -687,7 +776,7 @@ touchend: function (e) {
|
|
687
776
|
var t = e.currentTarget;
|
688
777
|
var ct = e.changedTouches[0];
|
689
778
|
if (this.info.started) {
|
690
|
-
|
779
|
+
Gestures.prevent('tap');
|
691
780
|
this.info.state = 'end';
|
692
781
|
this.info.addMove({
|
693
782
|
x: ct.clientX,
|
@@ -731,37 +820,37 @@ deps: [
|
|
731
820
|
'touchend'
|
732
821
|
],
|
733
822
|
emits: ['tap'],
|
734
|
-
|
823
|
+
info: {
|
735
824
|
x: NaN,
|
736
|
-
y: NaN
|
825
|
+
y: NaN,
|
826
|
+
prevent: false
|
737
827
|
},
|
738
828
|
reset: function () {
|
739
|
-
this.
|
740
|
-
this.
|
829
|
+
this.info.x = NaN;
|
830
|
+
this.info.y = NaN;
|
831
|
+
this.info.prevent = false;
|
741
832
|
},
|
742
833
|
save: function (e) {
|
743
|
-
this.
|
744
|
-
this.
|
834
|
+
this.info.x = e.clientX;
|
835
|
+
this.info.y = e.clientY;
|
745
836
|
},
|
746
837
|
mousedown: function (e) {
|
747
|
-
POINTERSTATE.tapPrevented = false;
|
748
838
|
this.save(e);
|
749
839
|
},
|
750
840
|
click: function (e) {
|
751
841
|
this.forward(e);
|
752
842
|
},
|
753
843
|
touchstart: function (e) {
|
754
|
-
POINTERSTATE.tapPrevented = false;
|
755
844
|
this.save(e.changedTouches[0]);
|
756
845
|
},
|
757
846
|
touchend: function (e) {
|
758
847
|
this.forward(e.changedTouches[0]);
|
759
848
|
},
|
760
849
|
forward: function (e) {
|
761
|
-
var dx = Math.abs(e.clientX - this.
|
762
|
-
var dy = Math.abs(e.clientY - this.
|
850
|
+
var dx = Math.abs(e.clientX - this.info.x);
|
851
|
+
var dy = Math.abs(e.clientY - this.info.y);
|
763
852
|
if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) {
|
764
|
-
if (!
|
853
|
+
if (!this.info.prevent) {
|
765
854
|
Gestures.fire(e.target, 'tap', {
|
766
855
|
x: e.clientX,
|
767
856
|
y: e.clientY,
|
@@ -786,6 +875,13 @@ Gestures.add(node, eventName, handler);
|
|
786
875
|
node.addEventListener(eventName, handler);
|
787
876
|
}
|
788
877
|
},
|
878
|
+
_unlisten: function (node, eventName, handler) {
|
879
|
+
if (Gestures.gestures[eventName]) {
|
880
|
+
Gestures.remove(node, eventName, handler);
|
881
|
+
} else {
|
882
|
+
node.removeEventListener(eventName, handler);
|
883
|
+
}
|
884
|
+
},
|
789
885
|
setScrollDirection: function (direction, node) {
|
790
886
|
node = node || this;
|
791
887
|
Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
|
@@ -931,9 +1027,10 @@ options = options || Polymer.nob;
|
|
931
1027
|
var node = options.node || this;
|
932
1028
|
var detail = detail === null || detail === undefined ? Polymer.nob : detail;
|
933
1029
|
var bubbles = options.bubbles === undefined ? true : options.bubbles;
|
1030
|
+
var cancelable = Boolean(options.cancelable);
|
934
1031
|
var event = new CustomEvent(type, {
|
935
1032
|
bubbles: Boolean(bubbles),
|
936
|
-
cancelable:
|
1033
|
+
cancelable: cancelable,
|
937
1034
|
detail: detail
|
938
1035
|
});
|
939
1036
|
node.dispatchEvent(event);
|
@@ -1013,7 +1110,7 @@ this.fire(eventName, { value: this[property] }, { bubbles: false });
|
|
1013
1110
|
},
|
1014
1111
|
_propertySet: function (property, value, effects) {
|
1015
1112
|
var old = this.__data__[property];
|
1016
|
-
if (old !== value) {
|
1113
|
+
if (old !== value && (old === old || value === value)) {
|
1017
1114
|
this.__data__[property] = value;
|
1018
1115
|
if (typeof value == 'object') {
|
1019
1116
|
this._clearPath(property);
|
@@ -1546,7 +1643,7 @@ h[0].call(this, h[1], h[2]);
|
|
1546
1643
|
Polymer.Base._addFeature({
|
1547
1644
|
notifyPath: function (path, value, fromAbove) {
|
1548
1645
|
var old = this._propertySet(path, value);
|
1549
|
-
if (old !== value) {
|
1646
|
+
if (old !== value && (old === old || value === value)) {
|
1550
1647
|
this._pathEffector(path, value);
|
1551
1648
|
if (!fromAbove) {
|
1552
1649
|
this._notifyPath(path, value);
|
@@ -1707,7 +1804,7 @@ object: array,
|
|
1707
1804
|
type: 'splice'
|
1708
1805
|
}];
|
1709
1806
|
var change = {
|
1710
|
-
keySplices: Polymer.Collection.
|
1807
|
+
keySplices: Polymer.Collection.applySplices(array, splices),
|
1711
1808
|
indexSplices: splices
|
1712
1809
|
};
|
1713
1810
|
this.set(path + '.splices', change);
|
@@ -1884,7 +1981,7 @@ var VAR_START = '--';
|
|
1884
1981
|
var MEDIA_START = '@media';
|
1885
1982
|
var AT_START = '@';
|
1886
1983
|
var rx = {
|
1887
|
-
comments: /\/\*[^*]*\*+([
|
1984
|
+
comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
|
1888
1985
|
port: /@import[^;]*;/gim,
|
1889
1986
|
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?;/gim,
|
1890
1987
|
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?};?/gim,
|
@@ -1912,7 +2009,7 @@ this.forEachStyleRule(this.rulesForStyle(s), callback);
|
|
1912
2009
|
}
|
1913
2010
|
},
|
1914
2011
|
rulesForStyle: function (style) {
|
1915
|
-
if (!style.__cssRules) {
|
2012
|
+
if (!style.__cssRules && style.textContent) {
|
1916
2013
|
style.__cssRules = this.parser.parse(style.textContent);
|
1917
2014
|
}
|
1918
2015
|
return style.__cssRules;
|
@@ -2074,6 +2171,8 @@ stop = true;
|
|
2074
2171
|
}
|
2075
2172
|
c = o.combinator;
|
2076
2173
|
s = o.value;
|
2174
|
+
} else {
|
2175
|
+
s = s.replace(SCOPE_JUMP, ' ');
|
2077
2176
|
}
|
2078
2177
|
return c + s;
|
2079
2178
|
});
|
@@ -2108,19 +2207,29 @@ var p$ = selector.split(PSEUDO_PREFIX);
|
|
2108
2207
|
p$[0] += scope;
|
2109
2208
|
return p$.join(PSEUDO_PREFIX);
|
2110
2209
|
},
|
2111
|
-
|
2112
|
-
|
2210
|
+
documentRule: function (rule) {
|
2211
|
+
rule.selector = rule.parsedSelector;
|
2212
|
+
this.normalizeRootSelector(rule);
|
2213
|
+
if (!nativeShadow) {
|
2214
|
+
this._transformRule(rule, this._transformDocumentSelector);
|
2215
|
+
}
|
2216
|
+
},
|
2217
|
+
normalizeRootSelector: function (rule) {
|
2218
|
+
if (rule.selector === ROOT) {
|
2219
|
+
rule.selector = 'body';
|
2220
|
+
}
|
2113
2221
|
},
|
2114
|
-
|
2115
|
-
return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector) : selector.trim()
|
2222
|
+
_transformDocumentSelector: function (selector) {
|
2223
|
+
return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) : this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);
|
2116
2224
|
},
|
2117
2225
|
SCOPE_NAME: 'style-scope'
|
2118
2226
|
};
|
2119
2227
|
var SCOPE_NAME = api.SCOPE_NAME;
|
2120
|
-
var
|
2228
|
+
var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME + ')';
|
2121
2229
|
var COMPLEX_SELECTOR_SEP = ',';
|
2122
2230
|
var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)([^\s>+~]+)/g;
|
2123
2231
|
var HOST = ':host';
|
2232
|
+
var ROOT = ':root';
|
2124
2233
|
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
2125
2234
|
var CONTENT = '::content';
|
2126
2235
|
var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//;
|
@@ -2296,6 +2405,7 @@ return mo;
|
|
2296
2405
|
});
|
2297
2406
|
}());
|
2298
2407
|
Polymer.StyleProperties = function () {
|
2408
|
+
'use strict';
|
2299
2409
|
var nativeShadow = Polymer.Settings.useNativeShadow;
|
2300
2410
|
var matchesSelector = Polymer.DomApi.matchesSelector;
|
2301
2411
|
var styleUtil = Polymer.StyleUtil;
|
@@ -2362,6 +2472,10 @@ collectPropertiesInCssText: function (cssText, props) {
|
|
2362
2472
|
var m;
|
2363
2473
|
while (m = this.rx.VAR_CAPTURE.exec(cssText)) {
|
2364
2474
|
props[m[1]] = true;
|
2475
|
+
var def = m[2];
|
2476
|
+
if (def && def.match(this.rx.IS_VAR)) {
|
2477
|
+
props[def] = true;
|
2478
|
+
}
|
2365
2479
|
}
|
2366
2480
|
},
|
2367
2481
|
reify: function (props) {
|
@@ -2461,27 +2575,29 @@ return props;
|
|
2461
2575
|
},
|
2462
2576
|
transformStyles: function (element, properties, scopeSelector) {
|
2463
2577
|
var self = this;
|
2464
|
-
var
|
2578
|
+
var hostSelector = styleTransformer._calcHostScope(element.is, element.extends);
|
2579
|
+
var rxHostSelector = element.extends ? '\\' + hostSelector.slice(0, -1) + '\\]' : hostSelector;
|
2580
|
+
var hostRx = new RegExp(this.rx.HOST_PREFIX + rxHostSelector + this.rx.HOST_SUFFIX);
|
2465
2581
|
return styleTransformer.elementStyles(element, function (rule) {
|
2466
2582
|
self.applyProperties(rule, properties);
|
2467
2583
|
if (rule.cssText && !nativeShadow) {
|
2468
|
-
self._scopeSelector(rule, hostRx,
|
2584
|
+
self._scopeSelector(rule, hostRx, hostSelector, element._scopeCssViaAttr, scopeSelector);
|
2469
2585
|
}
|
2470
2586
|
});
|
2471
2587
|
},
|
2472
|
-
_scopeSelector: function (rule, hostRx,
|
2588
|
+
_scopeSelector: function (rule, hostRx, hostSelector, viaAttr, scopeId) {
|
2473
2589
|
rule.transformedSelector = rule.transformedSelector || rule.selector;
|
2474
2590
|
var selector = rule.transformedSelector;
|
2475
2591
|
var scope = viaAttr ? '[' + styleTransformer.SCOPE_NAME + '~=' + scopeId + ']' : '.' + scopeId;
|
2476
2592
|
var parts = selector.split(',');
|
2477
2593
|
for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
|
2478
|
-
parts[i] = p.match(hostRx) ? p.replace(
|
2594
|
+
parts[i] = p.match(hostRx) ? p.replace(hostSelector, hostSelector + scope) : scope + ' ' + p;
|
2479
2595
|
}
|
2480
2596
|
rule.selector = parts.join(',');
|
2481
2597
|
},
|
2482
2598
|
applyElementScopeSelector: function (element, selector, old, viaAttr) {
|
2483
2599
|
var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.className;
|
2484
|
-
v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector;
|
2600
|
+
var v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector;
|
2485
2601
|
if (c !== v) {
|
2486
2602
|
if (viaAttr) {
|
2487
2603
|
element.setAttribute(styleTransformer.SCOPE_NAME, v);
|
@@ -2521,6 +2637,7 @@ VAR_ASSIGN: /(?:^|;\s*)(--[^\:;]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?=;)/gim,
|
|
2521
2637
|
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\);?/im,
|
2522
2638
|
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
|
2523
2639
|
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
|
2640
|
+
IS_VAR: /^--/,
|
2524
2641
|
BRACKETED: /\{[^}]*\}/g,
|
2525
2642
|
HOST_PREFIX: '(?:^|[^.])',
|
2526
2643
|
HOST_SUFFIX: '($|[.:[\\s>+~])'
|
@@ -2538,14 +2655,11 @@ bits[o] = (bits[o] || 0) | v;
|
|
2538
2655
|
Polymer.StyleDefaults = function () {
|
2539
2656
|
var styleProperties = Polymer.StyleProperties;
|
2540
2657
|
var styleUtil = Polymer.StyleUtil;
|
2541
|
-
var style = document.createElement('style');
|
2542
2658
|
var api = {
|
2543
|
-
|
2544
|
-
_styles: [style],
|
2659
|
+
_styles: [],
|
2545
2660
|
_properties: null,
|
2546
|
-
|
2547
|
-
this.style
|
2548
|
-
styleUtil.clearStyleRules(this.style);
|
2661
|
+
addStyle: function (style) {
|
2662
|
+
this._styles.push(style);
|
2549
2663
|
this._properties = null;
|
2550
2664
|
},
|
2551
2665
|
get _styleProperties() {
|
@@ -2553,6 +2667,7 @@ if (!this._properties) {
|
|
2553
2667
|
styleProperties.decorateStyles(this._styles);
|
2554
2668
|
this._styles._scopeStyleProperties = null;
|
2555
2669
|
this._properties = styleProperties.scopePropertiesFromStyles(this._styles);
|
2670
|
+
styleProperties.reify(this._properties);
|
2556
2671
|
}
|
2557
2672
|
return this._properties;
|
2558
2673
|
},
|
@@ -2560,6 +2675,14 @@ _needsStyleProperties: function () {
|
|
2560
2675
|
},
|
2561
2676
|
_computeStyleProperties: function () {
|
2562
2677
|
return this._styleProperties;
|
2678
|
+
},
|
2679
|
+
updateStyles: function () {
|
2680
|
+
this._styleCache.clear();
|
2681
|
+
for (var i = 0, s; i < this._styles.length; i++) {
|
2682
|
+
s = this._styles[i];
|
2683
|
+
s = s.__importElement || s;
|
2684
|
+
s._apply();
|
2685
|
+
}
|
2563
2686
|
}
|
2564
2687
|
};
|
2565
2688
|
return api;
|
@@ -2607,6 +2730,7 @@ return true;
|
|
2607
2730
|
};
|
2608
2731
|
}());
|
2609
2732
|
(function () {
|
2733
|
+
'use strict';
|
2610
2734
|
var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
|
2611
2735
|
var propertyUtils = Polymer.StyleProperties;
|
2612
2736
|
var styleTransformer = Polymer.StyleTransformer;
|
@@ -2646,7 +2770,7 @@ if (!scopeCached) {
|
|
2646
2770
|
info = styleCache.retrieve(this.is, this._ownStyleProperties, this._styles);
|
2647
2771
|
}
|
2648
2772
|
var globalCached = Boolean(info) && !scopeCached;
|
2649
|
-
style = this._applyStyleProperties(info);
|
2773
|
+
var style = this._applyStyleProperties(info);
|
2650
2774
|
if (!scopeCached) {
|
2651
2775
|
var cacheableStyle = style;
|
2652
2776
|
if (nativeShadow) {
|
@@ -2689,7 +2813,7 @@ _scopeCount: 0,
|
|
2689
2813
|
_applyStyleProperties: function (info) {
|
2690
2814
|
var oldScopeSelector = this._scopeSelector;
|
2691
2815
|
this._scopeSelector = info ? info._scopeSelector : this.is + '-' + this.__proto__._scopeCount++;
|
2692
|
-
style = propertyUtils.applyElementStyle(this, this._styleProperties, this._scopeSelector, info && info.style);
|
2816
|
+
var style = propertyUtils.applyElementStyle(this, this._styleProperties, this._scopeSelector, info && info.style);
|
2693
2817
|
if ((style || oldScopeSelector) && !nativeShadow) {
|
2694
2818
|
propertyUtils.applyElementScopeSelector(this, this._scopeSelector, oldScopeSelector, this._scopeCssViaAttr);
|
2695
2819
|
}
|
@@ -2738,7 +2862,7 @@ c.updateStyles();
|
|
2738
2862
|
}
|
2739
2863
|
});
|
2740
2864
|
Polymer.updateStyles = function () {
|
2741
|
-
styleDefaults.
|
2865
|
+
styleDefaults.updateStyles();
|
2742
2866
|
Polymer.Base._updateRootStyles(document);
|
2743
2867
|
};
|
2744
2868
|
var styleCache = new Polymer.StyleCache();
|
@@ -2790,48 +2914,47 @@ var nativeShadow = Polymer.Settings.useNativeShadow;
|
|
2790
2914
|
var propertyUtils = Polymer.StyleProperties;
|
2791
2915
|
var styleUtil = Polymer.StyleUtil;
|
2792
2916
|
var styleDefaults = Polymer.StyleDefaults;
|
2917
|
+
var styleTransformer = Polymer.StyleTransformer;
|
2793
2918
|
Polymer({
|
2794
2919
|
is: 'custom-style',
|
2795
2920
|
extends: 'style',
|
2796
2921
|
created: function () {
|
2797
|
-
this.
|
2798
|
-
|
2922
|
+
this._tryApply();
|
2923
|
+
},
|
2924
|
+
attached: function () {
|
2925
|
+
this._tryApply();
|
2926
|
+
},
|
2927
|
+
_tryApply: function () {
|
2928
|
+
if (!this._appliesToDocument) {
|
2929
|
+
if (this.parentNode && this.parentNode.localName !== 'dom-module') {
|
2930
|
+
this._appliesToDocument = true;
|
2799
2931
|
var e = this.__appliedElement || this;
|
2800
|
-
|
2801
|
-
|
2802
|
-
this.
|
2803
|
-
|
2932
|
+
styleDefaults.addStyle(e);
|
2933
|
+
if (e.textContent) {
|
2934
|
+
this._apply();
|
2935
|
+
} else {
|
2936
|
+
var observer = new MutationObserver(function () {
|
2937
|
+
observer.disconnect();
|
2938
|
+
this._apply();
|
2939
|
+
}.bind(this));
|
2940
|
+
observer.observe(e, { childList: true });
|
2941
|
+
}
|
2942
|
+
}
|
2804
2943
|
}
|
2805
2944
|
},
|
2806
|
-
|
2945
|
+
_apply: function () {
|
2807
2946
|
var e = this.__appliedElement || this;
|
2808
2947
|
this._computeStyleProperties();
|
2809
2948
|
var props = this._styleProperties;
|
2810
2949
|
var self = this;
|
2811
2950
|
e.textContent = styleUtil.toCssText(styleUtil.rulesForStyle(e), function (rule) {
|
2812
|
-
if (rule.selector === ':root') {
|
2813
|
-
rule.selector = 'body';
|
2814
|
-
}
|
2815
2951
|
var css = rule.cssText = rule.parsedCssText;
|
2816
2952
|
if (rule.propertyInfo && rule.propertyInfo.cssText) {
|
2817
2953
|
css = css.replace(propertyUtils.rx.VAR_ASSIGN, '');
|
2818
2954
|
rule.cssText = propertyUtils.valueForProperties(css, props);
|
2819
2955
|
}
|
2820
|
-
|
2821
|
-
Polymer.StyleTransformer.rootRule(rule);
|
2822
|
-
}
|
2956
|
+
styleTransformer.documentRule(rule);
|
2823
2957
|
});
|
2824
|
-
},
|
2825
|
-
_rulesToDefaultProperties: function (rules) {
|
2826
|
-
styleUtil.forEachStyleRule(rules, function (rule) {
|
2827
|
-
if (!rule.propertyInfo.properties) {
|
2828
|
-
rule.cssText = '';
|
2829
|
-
}
|
2830
|
-
});
|
2831
|
-
var cssText = styleUtil.parser.stringify(rules, true);
|
2832
|
-
if (cssText) {
|
2833
|
-
styleDefaults.applyCss(cssText);
|
2834
|
-
}
|
2835
2958
|
}
|
2836
2959
|
});
|
2837
2960
|
}());
|
@@ -3109,7 +3232,7 @@ items.push(store[key]);
|
|
3109
3232
|
}
|
3110
3233
|
return items;
|
3111
3234
|
},
|
3112
|
-
|
3235
|
+
_applySplices: function (splices) {
|
3113
3236
|
var keySplices = [];
|
3114
3237
|
for (var i = 0; i < splices.length; i++) {
|
3115
3238
|
var j, o, key, s = splices[i];
|
@@ -3138,6 +3261,10 @@ return keySplices;
|
|
3138
3261
|
Polymer.Collection.get = function (userArray) {
|
3139
3262
|
return Polymer._collections.get(userArray) || new Polymer.Collection(userArray);
|
3140
3263
|
};
|
3264
|
+
Polymer.Collection.applySplices = function (userArray, splices) {
|
3265
|
+
var coll = Polymer._collections.get(userArray);
|
3266
|
+
return coll ? coll._applySplices(splices) : null;
|
3267
|
+
};
|
3141
3268
|
Polymer({
|
3142
3269
|
is: 'dom-repeat',
|
3143
3270
|
extends: 'template',
|
@@ -3567,8 +3694,10 @@ if (this.multi) {
|
|
3567
3694
|
var scol = Polymer.Collection.get(this.selected);
|
3568
3695
|
var skey = scol.getKey(item);
|
3569
3696
|
if (skey >= 0) {
|
3697
|
+
if (this.toggle) {
|
3570
3698
|
this.deselect(item);
|
3571
|
-
}
|
3699
|
+
}
|
3700
|
+
} else {
|
3572
3701
|
this.push('selected', item);
|
3573
3702
|
this.async(function () {
|
3574
3703
|
skey = scol.getKey(item);
|