concerto_frontend 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d257eb60b1f42195f39957a4020dfd9c127cb67e
4
- data.tar.gz: a7acb3191f96328775f630e0b603e6812454f6a8
3
+ metadata.gz: cc35178df54df773cf262727dc50e9832b8e2b5a
4
+ data.tar.gz: 6475b902bdd78c60992532315451a2fbdc079478
5
5
  SHA512:
6
- metadata.gz: 79c04081e8acee95395141f157b04f9e8ae4a71791c1652c6a2406facd3706a0f642ec7069d530034c6996b32efbf76d42184e00f7f1157779d4181c350194a7
7
- data.tar.gz: e74c84ef36512b686a1b7ef53c3aeca636fca1324d8e14df0401283339870007ede4b1da930d4c49a7a94912ec27eb55e92ded8fa5f27dfa635e108c2bcc318e
6
+ metadata.gz: 44400dc0e487dfda38d01e9f62591db1e9b6253ecc0ea527db6b43a4ef4aad0ad128fdd4b57199dfbc418390609fc7dd65301e7e703c8e42d86a5c7f997cb2c0
7
+ data.tar.gz: 397d02c1ff8bd45139e1190eed09113f83557c042658c041e6de739e1661a9923119e3d4fefded7fd4c45062b80e404b243041c418ba0aede367a5d254fe0b71
@@ -15,10 +15,11 @@ addEventListener('DOMContentLoaded', resolve);
15
15
  window.Polymer = {
16
16
  Settings: function () {
17
17
  var user = window.Polymer || {};
18
- location.search.slice(1).split('&').forEach(function (o) {
18
+ var parts = location.search.slice(1).split('&');
19
+ for (var i = 0, o; i < parts.length && (o = parts[i]); i++) {
19
20
  o = o.split('=');
20
21
  o[0] && (user[o[0]] = o[1] || true);
21
- });
22
+ }
22
23
  var wantShadow = user.dom === 'shadow';
23
24
  var hasShadow = Boolean(Element.prototype.createShadowRoot);
24
25
  var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
@@ -105,15 +106,53 @@ this._callbacks.push(cb);
105
106
  },
106
107
  _makeReady: function () {
107
108
  this._ready = true;
108
- this._callbacks.forEach(function (cb) {
109
- cb();
110
- });
109
+ for (var i = 0; i < this._callbacks.length; i++) {
110
+ this._callbacks[i]();
111
+ }
111
112
  this._callbacks = [];
112
113
  },
113
114
  _catchFirstRender: function () {
114
115
  requestAnimationFrame(function () {
115
116
  Polymer.RenderStatus._makeReady();
116
117
  });
118
+ },
119
+ _afterNextRenderQueue: [],
120
+ _waitingNextRender: false,
121
+ afterNextRender: function (element, fn, args) {
122
+ this._watchNextRender();
123
+ this._afterNextRenderQueue.push([
124
+ element,
125
+ fn,
126
+ args
127
+ ]);
128
+ },
129
+ _watchNextRender: function () {
130
+ if (!this._waitingNextRender) {
131
+ this._waitingNextRender = true;
132
+ var fn = function () {
133
+ Polymer.RenderStatus._flushNextRender();
134
+ };
135
+ if (!this._ready) {
136
+ this.whenReady(fn);
137
+ } else {
138
+ requestAnimationFrame(fn);
139
+ }
140
+ }
141
+ },
142
+ _flushNextRender: function () {
143
+ var self = this;
144
+ setTimeout(function () {
145
+ self._flushRenderCallbacks(self._afterNextRenderQueue);
146
+ self._afterNextRenderQueue = [];
147
+ self._waitingNextRender = false;
148
+ });
149
+ },
150
+ _flushRenderCallbacks: function (callbacks) {
151
+ for (var i = 0, h; i < callbacks.length; i++) {
152
+ h = callbacks[i];
153
+ h[1].apply(h[0], h[2] || Polymer.nar);
154
+ }
155
+ ;
117
156
  }
118
157
  };
119
158
  if (window.HTMLImports) {
@@ -143,27 +182,33 @@ this._doBehavior('created');
143
182
  this._initFeatures();
144
183
  },
145
184
  attachedCallback: function () {
185
+ var self = this;
146
186
  Polymer.RenderStatus.whenReady(function () {
147
- this.isAttached = true;
148
- this._doBehavior('attached');
149
- }.bind(this));
187
+ self.isAttached = true;
188
+ self._doBehavior('attached');
189
+ });
150
190
  },
151
191
  detachedCallback: function () {
152
192
  this.isAttached = false;
153
193
  this._doBehavior('detached');
154
194
  },
155
- attributeChangedCallback: function (name) {
195
+ attributeChangedCallback: function (name, oldValue, newValue) {
156
196
  this._attributeChangedImpl(name);
157
- this._doBehavior('attributeChanged', arguments);
197
+ this._doBehavior('attributeChanged', [
198
+ name,
199
+ oldValue,
200
+ newValue
201
+ ]);
158
202
  },
159
203
  _attributeChangedImpl: function (name) {
160
204
  this._setAttributeToProperty(this, name);
161
205
  },
162
206
  extend: function (prototype, api) {
163
207
  if (prototype && api) {
164
- Object.getOwnPropertyNames(api).forEach(function (n) {
208
+ var n$ = Object.getOwnPropertyNames(api);
209
+ for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
165
210
  this.copyOwnProperty(n, api, prototype);
166
- }, this);
211
+ }
167
212
  }
168
213
  return prototype || api;
169
214
  },
@@ -241,7 +286,7 @@ import: function (id, selector) {
241
286
  if (id) {
242
287
  var m = findModule(id);
243
288
  if (!m) {
244
- forceDocumentUpgrade();
289
+ forceDomModulesUpgrade();
245
290
  m = findModule(id);
246
291
  }
247
292
  if (m && selector) {
@@ -253,12 +298,17 @@ return m;
253
298
  });
254
299
  var cePolyfill = window.CustomElements && !CustomElements.useNative;
255
300
  document.registerElement('dom-module', DomModule);
256
- function forceDocumentUpgrade() {
301
+ function forceDomModulesUpgrade() {
257
302
  if (cePolyfill) {
258
303
  var script = document._currentScript || document.currentScript;
259
- var doc = script && script.ownerDocument;
260
- if (doc) {
261
- CustomElements.upgradeAll(doc);
304
+ var doc = script && script.ownerDocument || document;
305
+ var modules = doc.querySelectorAll('dom-module');
306
+ for (var i = modules.length - 1, m; i >= 0 && (m = modules[i]); i--) {
307
+ if (m.__upgraded__) {
308
+ return;
309
+ } else {
310
+ CustomElements.upgrade(m);
311
+ }
262
312
  }
263
313
  }
264
314
  }
@@ -293,7 +343,8 @@ return behaviors;
293
343
  },
294
344
  _flattenBehaviorsList: function (behaviors) {
295
345
  var flat = [];
296
- behaviors.forEach(function (b) {
346
+ for (var i = 0; i < behaviors.length; i++) {
347
+ var b = behaviors[i];
297
348
  if (b instanceof Array) {
298
349
  flat = flat.concat(this._flattenBehaviorsList(b));
299
350
  } else if (b) {
@@ -301,31 +352,16 @@ flat.push(b);
301
352
  } else {
302
353
  this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
303
354
  }
304
- }, this);
355
+ }
305
356
  return flat;
306
357
  },
307
358
  _mixinBehavior: function (b) {
308
- Object.getOwnPropertyNames(b).forEach(function (n) {
309
- switch (n) {
310
- case 'hostAttributes':
311
- case 'registered':
312
- case 'properties':
313
- case 'observers':
314
- case 'listeners':
315
- case 'created':
316
- case 'attached':
317
- case 'detached':
318
- case 'attributeChanged':
319
- case 'configure':
320
- case 'ready':
321
- break;
322
- default:
323
- if (!this.hasOwnProperty(n)) {
359
+ var n$ = Object.getOwnPropertyNames(b);
360
+ for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
361
+ if (!Polymer.Base._behaviorProperties[n] && !this.hasOwnProperty(n)) {
324
362
  this.copyOwnProperty(n, b, this);
325
363
  }
326
- break;
327
364
  }
328
- }, this);
329
365
  },
330
366
  _prepBehaviors: function () {
331
367
  this._prepFlattenedBehaviors(this.behaviors);
@@ -337,9 +373,9 @@ this._prepBehavior(behaviors[i]);
337
373
  this._prepBehavior(this);
338
374
  },
339
375
  _doBehavior: function (name, args) {
340
- this.behaviors.forEach(function (b) {
341
- this._invokeBehavior(b, name, args);
342
- }, this);
376
+ for (var i = 0; i < this.behaviors.length; i++) {
377
+ this._invokeBehavior(this.behaviors[i], name, args);
378
+ }
343
379
  this._invokeBehavior(this, name, args);
344
380
  },
345
381
  _invokeBehavior: function (b, name, args) {
@@ -349,12 +385,24 @@ fn.apply(this, args || Polymer.nar);
349
385
  }
350
386
  },
351
387
  _marshalBehaviors: function () {
352
- this.behaviors.forEach(function (b) {
353
- this._marshalBehavior(b);
354
- }, this);
388
+ for (var i = 0; i < this.behaviors.length; i++) {
389
+ this._marshalBehavior(this.behaviors[i]);
390
+ }
355
391
  this._marshalBehavior(this);
356
392
  }
357
393
  });
394
+ Polymer.Base._behaviorProperties = {
395
+ hostAttributes: true,
396
+ registered: true,
397
+ properties: true,
398
+ observers: true,
399
+ listeners: true,
400
+ created: true,
401
+ attached: true,
402
+ detached: true,
403
+ attributeChanged: true,
404
+ ready: true
405
+ };
358
406
  Polymer.Base._addFeature({
359
407
  _getExtendedPrototype: function (tag) {
360
408
  return this._getExtendedNativePrototype(tag);
@@ -406,9 +454,13 @@ properties: {},
406
454
  getPropertyInfo: function (property) {
407
455
  var info = this._getPropertyInfo(property, this.properties);
408
456
  if (!info) {
409
- this.behaviors.some(function (b) {
410
- return info = this._getPropertyInfo(property, b.properties);
411
- }, this);
457
+ for (var i = 0; i < this.behaviors.length; i++) {
458
+ info = this._getPropertyInfo(property, this.behaviors[i].properties);
459
+ if (info) {
460
+ return info;
461
+ }
462
+ }
463
+ ;
412
464
  }
413
465
  return info || Polymer.nob;
414
466
  },
@@ -421,6 +473,40 @@ if (p) {
421
473
  p.defined = true;
422
474
  }
423
475
  return p;
476
+ },
477
+ _prepPropertyInfo: function () {
478
+ this._propertyInfo = {};
479
+ for (var i = 0, p; i < this.behaviors.length; i++) {
480
+ this._addPropertyInfo(this._propertyInfo, this.behaviors[i].properties);
481
+ }
482
+ this._addPropertyInfo(this._propertyInfo, this.properties);
483
+ this._addPropertyInfo(this._propertyInfo, this._propertyEffects);
484
+ },
485
+ _addPropertyInfo: function (target, source) {
486
+ if (source) {
487
+ var t, s;
488
+ for (var i in source) {
489
+ t = target[i];
490
+ s = source[i];
491
+ if (i[0] === '_' && !s.readOnly) {
492
+ continue;
493
+ }
494
+ if (!target[i]) {
495
+ target[i] = {
496
+ type: typeof s === 'function' ? s : s.type,
497
+ readOnly: s.readOnly,
498
+ attribute: Polymer.CaseMap.camelToDashCase(i)
499
+ };
500
+ } else {
501
+ if (!t.type) {
502
+ t.type = s.type;
503
+ }
504
+ if (!t.readOnly) {
505
+ t.readOnly = s.readOnly;
506
+ }
507
+ }
508
+ }
509
+ }
424
510
  }
425
511
  });
426
512
  Polymer.CaseMap = {
@@ -448,21 +534,24 @@ return g[0] + '-' + g[1].toLowerCase();
448
534
  }
449
535
  };
450
536
  Polymer.Base._addFeature({
451
- _prepAttributes: function () {
452
- this._aggregatedAttributes = {};
453
- },
454
537
  _addHostAttributes: function (attributes) {
538
+ if (!this._aggregatedAttributes) {
539
+ this._aggregatedAttributes = {};
540
+ }
455
541
  if (attributes) {
456
542
  this.mixin(this._aggregatedAttributes, attributes);
457
543
  }
458
544
  },
459
545
  _marshalHostAttributes: function () {
546
+ if (this._aggregatedAttributes) {
460
547
  this._applyAttributes(this, this._aggregatedAttributes);
548
+ }
461
549
  },
462
550
  _applyAttributes: function (node, attr$) {
463
551
  for (var n in attr$) {
464
552
  if (!this.hasAttribute(n) && n !== 'class') {
465
- this.serializeValueToAttribute(attr$[n], n, this);
553
+ var v = attr$[n];
554
+ this.serializeValueToAttribute(v, n, this);
466
555
  }
467
556
  }
468
557
  },
@@ -470,29 +559,40 @@ _marshalAttributes: function () {
470
559
  this._takeAttributesToModel(this);
471
560
  },
472
561
  _takeAttributesToModel: function (model) {
473
- for (var i = 0, l = this.attributes.length; i < l; i++) {
474
- this._setAttributeToProperty(model, this.attributes[i].name);
562
+ if (this.hasAttributes()) {
563
+ for (var i in this._propertyInfo) {
564
+ var info = this._propertyInfo[i];
565
+ if (this.hasAttribute(info.attribute)) {
566
+ this._setAttributeToProperty(model, info.attribute, i, info);
567
+ }
568
+ }
475
569
  }
476
570
  },
477
- _setAttributeToProperty: function (model, attrName) {
571
+ _setAttributeToProperty: function (model, attribute, property, info) {
478
572
  if (!this._serializing) {
479
- var propName = Polymer.CaseMap.dashToCamelCase(attrName);
480
- var info = this.getPropertyInfo(propName);
481
- if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
482
- var val = this.getAttribute(attrName);
483
- model[propName] = this.deserialize(val, info.type);
573
+ var property = property || Polymer.CaseMap.dashToCamelCase(attribute);
574
+ info = info || this._propertyInfo && this._propertyInfo[property];
575
+ if (info && !info.readOnly) {
576
+ var v = this.getAttribute(attribute);
577
+ model[property] = this.deserialize(v, info.type);
484
578
  }
485
579
  }
486
580
  },
487
581
  _serializing: false,
488
- reflectPropertyToAttribute: function (name) {
582
+ reflectPropertyToAttribute: function (property, attribute, value) {
489
583
  this._serializing = true;
490
- this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
584
+ value = value === undefined ? this[property] : value;
585
+ this.serializeValueToAttribute(value, attribute || Polymer.CaseMap.camelToDashCase(property));
491
586
  this._serializing = false;
492
587
  },
493
588
  serializeValueToAttribute: function (value, attribute, node) {
494
589
  var str = this.serialize(value);
495
- (node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
590
+ node = node || this;
591
+ if (str === undefined) {
592
+ node.removeAttribute(attribute);
593
+ } else {
594
+ node.setAttribute(attribute, str);
595
+ }
496
596
  },
497
597
  deserialize: function (value, type) {
498
598
  switch (type) {
@@ -568,13 +668,13 @@ debouncer.stop();
568
668
  }
569
669
  }
570
670
  });
571
- Polymer.version = '1.1.4';
671
+ Polymer.version = '1.2.3';
572
672
  Polymer.Base._addFeature({
573
673
  _registerFeatures: function () {
574
674
  this._prepIs();
575
- this._prepAttributes();
576
675
  this._prepBehaviors();
577
676
  this._prepConstructor();
677
+ this._prepPropertyInfo();
578
678
  },
579
679
  _prepBehavior: function (b) {
580
680
  this._addHostAttributes(b.hostAttributes);
@@ -590,13 +690,14 @@ this._marshalBehaviors();
590
690
 
591
691
  <script>Polymer.Base._addFeature({
592
692
  _prepTemplate: function () {
593
- this._template = this._template || Polymer.DomModule.import(this.is, 'template');
693
+ if (this._template === undefined) {
694
+ this._template = Polymer.DomModule.import(this.is, 'template');
695
+ }
594
696
  if (this._template && this._template.hasAttribute('is')) {
595
697
  this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
596
698
  }
597
- if (this._template && !this._template.content && HTMLTemplateElement.bootstrap) {
699
+ if (this._template && !this._template.content && window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
598
700
  HTMLTemplateElement.decorate(this._template);
599
- HTMLTemplateElement.bootstrap(this._template.content);
600
701
  }
601
702
  },
602
703
  _stampTemplate: function () {
@@ -615,20 +716,19 @@ Polymer.Base._addFeature({
615
716
  _hostStack: [],
616
717
  ready: function () {
617
718
  },
618
- _pushHost: function (host) {
719
+ _registerHost: function (host) {
619
720
  this.dataHost = host = host || Polymer.Base._hostStack[Polymer.Base._hostStack.length - 1];
620
721
  if (host && host._clients) {
621
722
  host._clients.push(this);
622
723
  }
623
- this._beginHost();
624
724
  },
625
- _beginHost: function () {
725
+ _beginHosting: function () {
626
726
  Polymer.Base._hostStack.push(this);
627
727
  if (!this._clients) {
628
728
  this._clients = [];
629
729
  }
630
730
  },
631
- _popHost: function () {
731
+ _endHosting: function () {
632
732
  Polymer.Base._hostStack.pop();
633
733
  },
634
734
  _tryReady: function () {
@@ -641,20 +741,24 @@ return !this.dataHost || this.dataHost._clientsReadied;
641
741
  },
642
742
  _ready: function () {
643
743
  this._beforeClientsReady();
744
+ if (this._template) {
644
745
  this._setupRoot();
645
746
  this._readyClients();
747
+ }
748
+ this._clientsReadied = true;
749
+ this._clients = null;
646
750
  this._afterClientsReady();
647
751
  this._readySelf();
648
752
  },
649
753
  _readyClients: function () {
650
754
  this._beginDistribute();
651
755
  var c$ = this._clients;
756
+ if (c$) {
652
757
  for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
653
758
  c._ready();
654
759
  }
760
+ }
655
761
  this._finishDistribute();
656
- this._clientsReadied = true;
657
- this._clients = null;
658
762
  },
659
763
  _readySelf: function () {
660
764
  this._doBehavior('ready');
@@ -850,61 +954,6 @@ return currentValue === previousValue;
850
954
  };
851
955
  return new ArraySplice();
852
956
  }();
853
- Polymer.EventApi = function () {
854
- var Settings = Polymer.Settings;
855
- var EventApi = function (event) {
856
- this.event = event;
857
- };
858
- if (Settings.useShadow) {
859
- EventApi.prototype = {
860
- get rootTarget() {
861
- return this.event.path[0];
862
- },
863
- get localTarget() {
864
- return this.event.target;
865
- },
866
- get path() {
867
- return this.event.path;
868
- }
869
- };
870
- } else {
871
- EventApi.prototype = {
872
- get rootTarget() {
873
- return this.event.target;
874
- },
875
- get localTarget() {
876
- var current = this.event.currentTarget;
877
- var currentRoot = current && Polymer.dom(current).getOwnerRoot();
878
- var p$ = this.path;
879
- for (var i = 0; i < p$.length; i++) {
880
- if (Polymer.dom(p$[i]).getOwnerRoot() === currentRoot) {
881
- return p$[i];
882
- }
883
- }
884
- },
885
- get path() {
886
- if (!this.event._path) {
887
- var path = [];
888
- var o = this.rootTarget;
889
- while (o) {
890
- path.push(o);
891
- o = Polymer.dom(o).parentNode || o.host;
892
- }
893
- path.push(window);
894
- this.event._path = path;
895
- }
896
- return this.event._path;
897
- }
898
- };
899
- }
900
- var factory = function (event) {
901
- if (!event.__eventApi) {
902
- event.__eventApi = new EventApi(event);
903
- }
904
- return event.__eventApi;
905
- };
906
- return { factory: factory };
907
- }();
908
957
  Polymer.domInnerHTML = function () {
909
958
  var escapeAttrRegExp = /[&\u00A0"]/g;
910
959
  var escapeDataRegExp = /[&\u00A0<>]/g;
@@ -1012,24 +1061,31 @@ var nativeRemoveChild = Element.prototype.removeChild;
1012
1061
  var nativeAppendChild = Element.prototype.appendChild;
1013
1062
  var nativeCloneNode = Element.prototype.cloneNode;
1014
1063
  var nativeImportNode = Document.prototype.importNode;
1015
- var DomApi = function (node) {
1016
- this.node = node;
1017
- if (this.patch) {
1018
- this.patch();
1019
- }
1064
+ var needsToWrap = Settings.hasShadow && !Settings.nativeShadow;
1065
+ var wrap = window.wrap ? window.wrap : function (node) {
1066
+ return node;
1020
1067
  };
1021
- if (window.wrap && Settings.useShadow && !Settings.useNativeShadow) {
1022
- DomApi = function (node) {
1023
- this.node = wrap(node);
1068
+ var DomApi = function (node) {
1069
+ this.node = needsToWrap ? wrap(node) : node;
1024
1070
  if (this.patch) {
1025
1071
  this.patch();
1026
1072
  }
1027
1073
  };
1028
- }
1029
1074
  DomApi.prototype = {
1030
1075
  flush: function () {
1031
1076
  Polymer.dom.flush();
1032
1077
  },
1078
+ deepContains: function (node) {
1079
+ if (this.node.contains(node)) {
1080
+ return true;
1081
+ }
1082
+ var n = node;
1083
+ var wrappedDocument = wrap(document);
1084
+ while (n && n !== wrappedDocument && n !== this.node) {
1085
+ n = Polymer.dom(n).parentNode || n.host;
1086
+ }
1087
+ return n === this.node;
1088
+ },
1033
1089
  _lazyDistribute: function (host) {
1034
1090
  if (host.shadyRoot && host.shadyRoot._distributionClean) {
1035
1091
  host.shadyRoot._distributionClean = false;
@@ -1043,7 +1099,7 @@ insertBefore: function (node, ref_node) {
1043
1099
  return this._addNode(node, ref_node);
1044
1100
  },
1045
1101
  _addNode: function (node, ref_node) {
1046
- this._removeNodeFromHost(node, true);
1102
+ this._removeNodeFromParent(node);
1047
1103
  var addedInsertionPoint;
1048
1104
  var root = this.getOwnerRoot();
1049
1105
  if (root) {
@@ -1075,6 +1131,7 @@ nativeAppendChild.call(container, node);
1075
1131
  if (addedInsertionPoint) {
1076
1132
  this._updateInsertionPoints(root.host);
1077
1133
  }
1134
+ this.notifyObserver();
1078
1135
  return node;
1079
1136
  },
1080
1137
  removeChild: function (node) {
@@ -1089,6 +1146,7 @@ removeFromComposedParent(container, node);
1089
1146
  nativeRemoveChild.call(container, node);
1090
1147
  }
1091
1148
  }
1149
+ this.notifyObserver();
1092
1150
  return node;
1093
1151
  },
1094
1152
  replaceChild: function (node, ref_node) {
@@ -1181,6 +1239,13 @@ return Boolean(node._lightChildren !== undefined);
1181
1239
  _parentNeedsDistribution: function (parent) {
1182
1240
  return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
1183
1241
  },
1242
+ _removeNodeFromParent: function (node) {
1243
+ var parent = node._lightParent || node.parentNode;
1244
+ if (parent && hasDomApi(parent)) {
1245
+ factory(parent).notifyObserver();
1246
+ }
1247
+ this._removeNodeFromHost(node, true);
1248
+ },
1184
1249
  _removeNodeFromHost: function (node, ensureComposedRemoval) {
1185
1250
  var hostNeedsDist;
1186
1251
  var root;
@@ -1192,7 +1257,7 @@ if (root) {
1192
1257
  root.host._elementRemove(node);
1193
1258
  hostNeedsDist = this._removeDistributedChildren(root, node);
1194
1259
  }
1195
- this._removeLogicalInfo(node, node._lightParent);
1260
+ this._removeLogicalInfo(node, parent);
1196
1261
  }
1197
1262
  this._removeOwnerShadyRoot(node);
1198
1263
  if (root && hostNeedsDist) {
@@ -1240,7 +1305,7 @@ _addLogicalInfo: function (node, container, index) {
1240
1305
  var children = factory(container).childNodes;
1241
1306
  index = index === undefined ? children.length : index;
1242
1307
  if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1243
- var c$ = Array.prototype.slice.call(node.childNodes);
1308
+ var c$ = arrayCopyChildNodes(node);
1244
1309
  for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
1245
1310
  children.splice(index++, 0, n);
1246
1311
  n._lightParent = container;
@@ -1311,24 +1376,29 @@ getDistributedNodes: function () {
1311
1376
  return this.node._distributedNodes || [];
1312
1377
  },
1313
1378
  queryDistributedElements: function (selector) {
1314
- var c$ = this.childNodes;
1379
+ var c$ = this.getEffectiveChildNodes();
1315
1380
  var list = [];
1316
- this._distributedFilter(selector, c$, list);
1317
1381
  for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
1318
- if (c.localName === CONTENT) {
1319
- this._distributedFilter(selector, factory(c).getDistributedNodes(), list);
1382
+ if (c.nodeType === Node.ELEMENT_NODE && matchesSelector.call(c, selector)) {
1383
+ list.push(c);
1320
1384
  }
1321
1385
  }
1322
1386
  return list;
1323
1387
  },
1324
- _distributedFilter: function (selector, list, results) {
1325
- results = results || [];
1326
- for (var i = 0, l = list.length, d; i < l && (d = list[i]); i++) {
1327
- if (d.nodeType === Node.ELEMENT_NODE && d.localName !== CONTENT && matchesSelector.call(d, selector)) {
1328
- results.push(d);
1388
+ getEffectiveChildNodes: function () {
1389
+ var list = [];
1390
+ var c$ = this.childNodes;
1391
+ for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
1392
+ if (c.localName === CONTENT) {
1393
+ var d$ = factory(c).getDistributedNodes();
1394
+ for (var j = 0; j < d$.length; j++) {
1395
+ list.push(d$[j]);
1396
+ }
1397
+ } else {
1398
+ list.push(c);
1329
1399
  }
1330
1400
  }
1331
- return results;
1401
+ return list;
1332
1402
  },
1333
1403
  _clear: function () {
1334
1404
  while (this.childNodes.length) {
@@ -1372,36 +1442,24 @@ d.appendChild(nc);
1372
1442
  }
1373
1443
  }
1374
1444
  return n;
1445
+ },
1446
+ observeNodes: function (callback) {
1447
+ if (callback) {
1448
+ if (!this.observer) {
1449
+ this.observer = this.node.localName === CONTENT ? new DomApi.DistributedNodesObserver(this) : new DomApi.EffectiveNodesObserver(this);
1375
1450
  }
1376
- };
1377
- Object.defineProperty(DomApi.prototype, 'classList', {
1378
- get: function () {
1379
- if (!this._classList) {
1380
- this._classList = new DomApi.ClassList(this);
1451
+ return this.observer.addListener(callback);
1381
1452
  }
1382
- return this._classList;
1383
- },
1384
- configurable: true
1385
- });
1386
- DomApi.ClassList = function (host) {
1387
- this.domApi = host;
1388
- this.node = host.node;
1389
- };
1390
- DomApi.ClassList.prototype = {
1391
- add: function () {
1392
- this.node.classList.add.apply(this.node.classList, arguments);
1393
- this.domApi._distributeParent();
1394
- },
1395
- remove: function () {
1396
- this.node.classList.remove.apply(this.node.classList, arguments);
1397
- this.domApi._distributeParent();
1398
1453
  },
1399
- toggle: function () {
1400
- this.node.classList.toggle.apply(this.node.classList, arguments);
1401
- this.domApi._distributeParent();
1454
+ unobserveNodes: function (handle) {
1455
+ if (this.observer) {
1456
+ this.observer.removeListener(handle);
1457
+ }
1402
1458
  },
1403
- contains: function () {
1404
- return this.node.classList.contains.apply(this.node.classList, arguments);
1459
+ notifyObserver: function () {
1460
+ if (this.observer) {
1461
+ this.observer.notify();
1462
+ }
1405
1463
  }
1406
1464
  };
1407
1465
  if (!Settings.useShadow) {
@@ -1409,7 +1467,7 @@ Object.defineProperties(DomApi.prototype, {
1409
1467
  childNodes: {
1410
1468
  get: function () {
1411
1469
  var c$ = getLightChildren(this.node);
1412
- return Array.isArray(c$) ? c$ : Array.prototype.slice.call(c$);
1470
+ return Array.isArray(c$) ? c$ : arrayCopyChildNodes(this.node);
1413
1471
  },
1414
1472
  configurable: true
1415
1473
  },
@@ -1532,7 +1590,7 @@ if (nt !== Node.TEXT_NODE || nt !== Node.COMMENT_NODE) {
1532
1590
  this._clear();
1533
1591
  var d = document.createElement('div');
1534
1592
  d.innerHTML = text;
1535
- var c$ = Array.prototype.slice.call(d.childNodes);
1593
+ var c$ = arrayCopyChildNodes(d);
1536
1594
  for (var i = 0; i < c$.length; i++) {
1537
1595
  this.appendChild(c$[i]);
1538
1596
  }
@@ -1545,20 +1603,25 @@ DomApi.prototype._getComposedInnerHTML = function () {
1545
1603
  return getInnerHTML(this.node, true);
1546
1604
  };
1547
1605
  } else {
1548
- var forwardMethods = [
1606
+ var forwardMethods = function (m$) {
1607
+ for (var i = 0; i < m$.length; i++) {
1608
+ forwardMethod(m$[i]);
1609
+ }
1610
+ };
1611
+ var forwardMethod = function (method) {
1612
+ DomApi.prototype[method] = function () {
1613
+ return this.node[method].apply(this.node, arguments);
1614
+ };
1615
+ };
1616
+ forwardMethods([
1549
1617
  'cloneNode',
1550
1618
  'appendChild',
1551
1619
  'insertBefore',
1552
1620
  'removeChild',
1553
1621
  'replaceChild'
1554
- ];
1555
- forwardMethods.forEach(function (name) {
1556
- DomApi.prototype[name] = function () {
1557
- return this.node[name].apply(this.node, arguments);
1558
- };
1559
- });
1622
+ ]);
1560
1623
  DomApi.prototype.querySelectorAll = function (selector) {
1561
- return Array.prototype.slice.call(this.node.querySelectorAll(selector));
1624
+ return arrayCopy(this.node.querySelectorAll(selector));
1562
1625
  };
1563
1626
  DomApi.prototype.getOwnerRoot = function () {
1564
1627
  var n = this.node;
@@ -1575,24 +1638,24 @@ return doc.importNode(externalNode, deep);
1575
1638
  };
1576
1639
  DomApi.prototype.getDestinationInsertionPoints = function () {
1577
1640
  var n$ = this.node.getDestinationInsertionPoints && this.node.getDestinationInsertionPoints();
1578
- return n$ ? Array.prototype.slice.call(n$) : [];
1641
+ return n$ ? arrayCopy(n$) : [];
1579
1642
  };
1580
1643
  DomApi.prototype.getDistributedNodes = function () {
1581
1644
  var n$ = this.node.getDistributedNodes && this.node.getDistributedNodes();
1582
- return n$ ? Array.prototype.slice.call(n$) : [];
1645
+ return n$ ? arrayCopy(n$) : [];
1583
1646
  };
1584
1647
  DomApi.prototype._distributeParent = function () {
1585
1648
  };
1586
1649
  Object.defineProperties(DomApi.prototype, {
1587
1650
  childNodes: {
1588
1651
  get: function () {
1589
- return Array.prototype.slice.call(this.node.childNodes);
1652
+ return arrayCopyChildNodes(this.node);
1590
1653
  },
1591
1654
  configurable: true
1592
1655
  },
1593
1656
  children: {
1594
1657
  get: function () {
1595
- return Array.prototype.slice.call(this.node.children);
1658
+ return arrayCopyChildren(this.node);
1596
1659
  },
1597
1660
  configurable: true
1598
1661
  },
@@ -1615,7 +1678,20 @@ return this.node.innerHTML = value;
1615
1678
  configurable: true
1616
1679
  }
1617
1680
  });
1618
- var forwardProperties = [
1681
+ var forwardProperties = function (f$) {
1682
+ for (var i = 0; i < f$.length; i++) {
1683
+ forwardProperty(f$[i]);
1684
+ }
1685
+ };
1686
+ var forwardProperty = function (name) {
1687
+ Object.defineProperty(DomApi.prototype, name, {
1688
+ get: function () {
1689
+ return this.node[name];
1690
+ },
1691
+ configurable: true
1692
+ });
1693
+ };
1694
+ forwardProperties([
1619
1695
  'parentNode',
1620
1696
  'firstChild',
1621
1697
  'lastChild',
@@ -1625,24 +1701,21 @@ var forwardProperties = [
1625
1701
  'lastElementChild',
1626
1702
  'nextElementSibling',
1627
1703
  'previousElementSibling'
1628
- ];
1629
- forwardProperties.forEach(function (name) {
1630
- Object.defineProperty(DomApi.prototype, name, {
1631
- get: function () {
1632
- return this.node[name];
1633
- },
1634
- configurable: true
1635
- });
1636
- });
1704
+ ]);
1637
1705
  }
1638
1706
  var CONTENT = 'content';
1639
- var factory = function (node, patch) {
1707
+ function factory(node, patch) {
1640
1708
  node = node || document;
1641
1709
  if (!node.__domApi) {
1642
1710
  node.__domApi = new DomApi(node, patch);
1643
1711
  }
1644
1712
  return node.__domApi;
1645
- };
1713
+ }
1714
+ ;
1715
+ function hasDomApi(node) {
1716
+ return Boolean(node.__domApi);
1717
+ }
1718
+ ;
1646
1719
  Polymer.dom = function (obj, patch) {
1647
1720
  if (obj instanceof Event) {
1648
1721
  return Polymer.EventApi.factory(obj);
@@ -1650,50 +1723,13 @@ return Polymer.EventApi.factory(obj);
1650
1723
  return factory(obj, patch);
1651
1724
  }
1652
1725
  };
1653
- Polymer.Base.extend(Polymer.dom, {
1654
- _flushGuard: 0,
1655
- _FLUSH_MAX: 100,
1656
- _needsTakeRecords: !Polymer.Settings.useNativeCustomElements,
1657
- _debouncers: [],
1658
- _finishDebouncer: null,
1659
- flush: function () {
1660
- for (var i = 0; i < this._debouncers.length; i++) {
1661
- this._debouncers[i].complete();
1662
- }
1663
- if (this._finishDebouncer) {
1664
- this._finishDebouncer.complete();
1665
- }
1666
- this._flushPolyfills();
1667
- if (this._debouncers.length && this._flushGuard < this._FLUSH_MAX) {
1668
- this._flushGuard++;
1669
- this.flush();
1670
- } else {
1671
- if (this._flushGuard >= this._FLUSH_MAX) {
1672
- console.warn('Polymer.dom.flush aborted. Flush may not be complete.');
1673
- }
1674
- this._flushGuard = 0;
1675
- }
1676
- },
1677
- _flushPolyfills: function () {
1678
- if (this._needsTakeRecords) {
1679
- CustomElements.takeRecords();
1680
- }
1681
- },
1682
- addDebouncer: function (debouncer) {
1683
- this._debouncers.push(debouncer);
1684
- this._finishDebouncer = Polymer.Debounce(this._finishDebouncer, this._finishFlush);
1685
- },
1686
- _finishFlush: function () {
1687
- Polymer.dom._debouncers = [];
1688
- }
1689
- });
1690
1726
  function getLightChildren(node) {
1691
1727
  var children = node._lightChildren;
1692
1728
  return children ? children : node.childNodes;
1693
1729
  }
1694
1730
  function getComposedChildren(node) {
1695
1731
  if (!node._composedChildren) {
1696
- node._composedChildren = Array.prototype.slice.call(node.childNodes);
1732
+ node._composedChildren = arrayCopyChildNodes(node);
1697
1733
  }
1698
1734
  return node._composedChildren;
1699
1735
  }
@@ -1729,13 +1765,35 @@ children.splice(i, 1);
1729
1765
  }
1730
1766
  function saveLightChildrenIfNeeded(node) {
1731
1767
  if (!node._lightChildren) {
1732
- var c$ = Array.prototype.slice.call(node.childNodes);
1768
+ var c$ = arrayCopyChildNodes(node);
1733
1769
  for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
1734
1770
  child._lightParent = child._lightParent || node;
1735
1771
  }
1736
1772
  node._lightChildren = c$;
1737
1773
  }
1738
1774
  }
1775
+ function arrayCopyChildNodes(parent) {
1776
+ var copy = [], i = 0;
1777
+ for (var n = parent.firstChild; n; n = n.nextSibling) {
1778
+ copy[i++] = n;
1779
+ }
1780
+ return copy;
1781
+ }
1782
+ function arrayCopyChildren(parent) {
1783
+ var copy = [], i = 0;
1784
+ for (var n = parent.firstElementChild; n; n = n.nextElementSibling) {
1785
+ copy[i++] = n;
1786
+ }
1787
+ return copy;
1788
+ }
1789
+ function arrayCopy(a$) {
1790
+ var l = a$.length;
1791
+ var copy = new Array(l);
1792
+ for (var i = 0; i < l; i++) {
1793
+ copy[i] = a$[i];
1794
+ }
1795
+ return copy;
1796
+ }
1739
1797
  function hasInsertionPoint(root) {
1740
1798
  return Boolean(root && root._insertionPoints.length);
1741
1799
  }
@@ -1750,17 +1808,418 @@ saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
1750
1808
  matchesSelector: matchesSelector,
1751
1809
  hasInsertionPoint: hasInsertionPoint,
1752
1810
  ctor: DomApi,
1753
- factory: factory
1811
+ factory: factory,
1812
+ hasDomApi: hasDomApi,
1813
+ arrayCopy: arrayCopy,
1814
+ arrayCopyChildNodes: arrayCopyChildNodes,
1815
+ arrayCopyChildren: arrayCopyChildren,
1816
+ wrap: wrap
1754
1817
  };
1755
1818
  }();
1756
- (function () {
1757
- Polymer.Base._addFeature({
1758
- _prepShady: function () {
1759
- this._useContent = this._useContent || Boolean(this._template);
1760
- },
1761
- _poolContent: function () {
1762
- if (this._useContent) {
1763
- saveLightChildrenIfNeeded(this);
1819
+ Polymer.Base.extend(Polymer.dom, {
1820
+ _flushGuard: 0,
1821
+ _FLUSH_MAX: 100,
1822
+ _needsTakeRecords: !Polymer.Settings.useNativeCustomElements,
1823
+ _debouncers: [],
1824
+ _staticFlushList: [],
1825
+ _finishDebouncer: null,
1826
+ flush: function () {
1827
+ this._flushGuard = 0;
1828
+ this._prepareFlush();
1829
+ while (this._debouncers.length && this._flushGuard < this._FLUSH_MAX) {
1830
+ for (var i = 0; i < this._debouncers.length; i++) {
1831
+ this._debouncers[i].complete();
1832
+ }
1833
+ if (this._finishDebouncer) {
1834
+ this._finishDebouncer.complete();
1835
+ }
1836
+ this._prepareFlush();
1837
+ this._flushGuard++;
1838
+ }
1839
+ if (this._flushGuard >= this._FLUSH_MAX) {
1840
+ console.warn('Polymer.dom.flush aborted. Flush may not be complete.');
1841
+ }
1842
+ },
1843
+ _prepareFlush: function () {
1844
+ if (this._needsTakeRecords) {
1845
+ CustomElements.takeRecords();
1846
+ }
1847
+ for (var i = 0; i < this._staticFlushList.length; i++) {
1848
+ this._staticFlushList[i]();
1849
+ }
1850
+ },
1851
+ addStaticFlush: function (fn) {
1852
+ this._staticFlushList.push(fn);
1853
+ },
1854
+ removeStaticFlush: function (fn) {
1855
+ var i = this._staticFlushList.indexOf(fn);
1856
+ if (i >= 0) {
1857
+ this._staticFlushList.splice(i, 1);
1858
+ }
1859
+ },
1860
+ addDebouncer: function (debouncer) {
1861
+ this._debouncers.push(debouncer);
1862
+ this._finishDebouncer = Polymer.Debounce(this._finishDebouncer, this._finishFlush);
1863
+ },
1864
+ _finishFlush: function () {
1865
+ Polymer.dom._debouncers = [];
1866
+ }
1867
+ });
1868
+ Polymer.EventApi = function () {
1869
+ 'use strict';
1870
+ var DomApi = Polymer.DomApi.ctor;
1871
+ var Settings = Polymer.Settings;
1872
+ DomApi.Event = function (event) {
1873
+ this.event = event;
1874
+ };
1875
+ if (Settings.useShadow) {
1876
+ DomApi.Event.prototype = {
1877
+ get rootTarget() {
1878
+ return this.event.path[0];
1879
+ },
1880
+ get localTarget() {
1881
+ return this.event.target;
1882
+ },
1883
+ get path() {
1884
+ return this.event.path;
1885
+ }
1886
+ };
1887
+ } else {
1888
+ DomApi.Event.prototype = {
1889
+ get rootTarget() {
1890
+ return this.event.target;
1891
+ },
1892
+ get localTarget() {
1893
+ var current = this.event.currentTarget;
1894
+ var currentRoot = current && Polymer.dom(current).getOwnerRoot();
1895
+ var p$ = this.path;
1896
+ for (var i = 0; i < p$.length; i++) {
1897
+ if (Polymer.dom(p$[i]).getOwnerRoot() === currentRoot) {
1898
+ return p$[i];
1899
+ }
1900
+ }
1901
+ },
1902
+ get path() {
1903
+ if (!this.event._path) {
1904
+ var path = [];
1905
+ var o = this.rootTarget;
1906
+ while (o) {
1907
+ path.push(o);
1908
+ o = Polymer.dom(o).parentNode || o.host;
1909
+ }
1910
+ path.push(window);
1911
+ this.event._path = path;
1912
+ }
1913
+ return this.event._path;
1914
+ }
1915
+ };
1916
+ }
1917
+ var factory = function (event) {
1918
+ if (!event.__eventApi) {
1919
+ event.__eventApi = new DomApi.Event(event);
1920
+ }
1921
+ return event.__eventApi;
1922
+ };
1923
+ return { factory: factory };
1924
+ }();
1925
+ (function () {
1926
+ 'use strict';
1927
+ var DomApi = Polymer.DomApi.ctor;
1928
+ Object.defineProperty(DomApi.prototype, 'classList', {
1929
+ get: function () {
1930
+ if (!this._classList) {
1931
+ this._classList = new DomApi.ClassList(this);
1932
+ }
1933
+ return this._classList;
1934
+ },
1935
+ configurable: true
1936
+ });
1937
+ DomApi.ClassList = function (host) {
1938
+ this.domApi = host;
1939
+ this.node = host.node;
1940
+ };
1941
+ DomApi.ClassList.prototype = {
1942
+ add: function () {
1943
+ this.node.classList.add.apply(this.node.classList, arguments);
1944
+ this.domApi._distributeParent();
1945
+ },
1946
+ remove: function () {
1947
+ this.node.classList.remove.apply(this.node.classList, arguments);
1948
+ this.domApi._distributeParent();
1949
+ },
1950
+ toggle: function () {
1951
+ this.node.classList.toggle.apply(this.node.classList, arguments);
1952
+ this.domApi._distributeParent();
1953
+ },
1954
+ contains: function () {
1955
+ return this.node.classList.contains.apply(this.node.classList, arguments);
1956
+ }
1957
+ };
1958
+ }());
1959
+ (function () {
1960
+ 'use strict';
1961
+ var DomApi = Polymer.DomApi.ctor;
1962
+ var Settings = Polymer.Settings;
1963
+ var hasDomApi = Polymer.DomApi.hasDomApi;
1964
+ DomApi.EffectiveNodesObserver = function (domApi) {
1965
+ this.domApi = domApi;
1966
+ this.node = this.domApi.node;
1967
+ this._listeners = [];
1968
+ };
1969
+ DomApi.EffectiveNodesObserver.prototype = {
1970
+ addListener: function (callback) {
1971
+ if (!this._isSetup) {
1972
+ this._setup();
1973
+ this._isSetup = true;
1974
+ }
1975
+ var listener = {
1976
+ fn: callback,
1977
+ _nodes: []
1978
+ };
1979
+ this._listeners.push(listener);
1980
+ this._scheduleNotify();
1981
+ return listener;
1982
+ },
1983
+ removeListener: function (handle) {
1984
+ var i = this._listeners.indexOf(handle);
1985
+ if (i >= 0) {
1986
+ this._listeners.splice(i, 1);
1987
+ handle._nodes = [];
1988
+ }
1989
+ if (!this._hasListeners()) {
1990
+ this._cleanup();
1991
+ this._isSetup = false;
1992
+ }
1993
+ },
1994
+ _setup: function () {
1995
+ this._observeContentElements(this.domApi.childNodes);
1996
+ },
1997
+ _cleanup: function () {
1998
+ this._unobserveContentElements(this.domApi.childNodes);
1999
+ },
2000
+ _hasListeners: function () {
2001
+ return Boolean(this._listeners.length);
2002
+ },
2003
+ _scheduleNotify: function () {
2004
+ if (this._debouncer) {
2005
+ this._debouncer.stop();
2006
+ }
2007
+ this._debouncer = Polymer.Debounce(this._debouncer, this._notify);
2008
+ this._debouncer.context = this;
2009
+ Polymer.dom.addDebouncer(this._debouncer);
2010
+ },
2011
+ notify: function () {
2012
+ if (this._hasListeners()) {
2013
+ this._scheduleNotify();
2014
+ }
2015
+ },
2016
+ _notify: function (mxns) {
2017
+ this._beforeCallListeners();
2018
+ this._callListeners();
2019
+ },
2020
+ _beforeCallListeners: function () {
2021
+ this._updateContentElements();
2022
+ },
2023
+ _updateContentElements: function () {
2024
+ this._observeContentElements(this.domApi.childNodes);
2025
+ },
2026
+ _observeContentElements: function (elements) {
2027
+ for (var i = 0, n; i < elements.length && (n = elements[i]); i++) {
2028
+ if (this._isContent(n)) {
2029
+ n.__observeNodesMap = n.__observeNodesMap || new WeakMap();
2030
+ if (!n.__observeNodesMap.has(this)) {
2031
+ n.__observeNodesMap.set(this, this._observeContent(n));
2032
+ }
2033
+ }
2034
+ }
2035
+ },
2036
+ _observeContent: function (content) {
2037
+ var self = this;
2038
+ var h = Polymer.dom(content).observeNodes(function () {
2039
+ self._scheduleNotify();
2040
+ });
2041
+ h._avoidChangeCalculation = true;
2042
+ return h;
2043
+ },
2044
+ _unobserveContentElements: function (elements) {
2045
+ for (var i = 0, n, h; i < elements.length && (n = elements[i]); i++) {
2046
+ if (this._isContent(n)) {
2047
+ h = n.__observeNodesMap.get(this);
2048
+ if (h) {
2049
+ Polymer.dom(n).unobserveNodes(h);
2050
+ n.__observeNodesMap.delete(this);
2051
+ }
2052
+ }
2053
+ }
2054
+ },
2055
+ _isContent: function (node) {
2056
+ return node.localName === 'content';
2057
+ },
2058
+ _callListeners: function () {
2059
+ var o$ = this._listeners;
2060
+ var nodes = this._getEffectiveNodes();
2061
+ for (var i = 0, o; i < o$.length && (o = o$[i]); i++) {
2062
+ var info = this._generateListenerInfo(o, nodes);
2063
+ if (info || o._alwaysNotify) {
2064
+ this._callListener(o, info);
2065
+ }
2066
+ }
2067
+ },
2068
+ _getEffectiveNodes: function () {
2069
+ return this.domApi.getEffectiveChildNodes();
2070
+ },
2071
+ _generateListenerInfo: function (listener, newNodes) {
2072
+ if (listener._avoidChangeCalculation) {
2073
+ return true;
2074
+ }
2075
+ var oldNodes = listener._nodes;
2076
+ var info = {
2077
+ target: this.node,
2078
+ addedNodes: [],
2079
+ removedNodes: []
2080
+ };
2081
+ var splices = Polymer.ArraySplice.calculateSplices(newNodes, oldNodes);
2082
+ for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
2083
+ for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
2084
+ info.removedNodes.push(n);
2085
+ }
2086
+ }
2087
+ for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
2088
+ for (var j = s.index; j < s.index + s.addedCount; j++) {
2089
+ info.addedNodes.push(newNodes[j]);
2090
+ }
2091
+ }
2092
+ listener._nodes = newNodes;
2093
+ if (info.addedNodes.length || info.removedNodes.length) {
2094
+ return info;
2095
+ }
2096
+ },
2097
+ _callListener: function (listener, info) {
2098
+ return listener.fn.call(this.node, info);
2099
+ },
2100
+ enableShadowAttributeTracking: function () {
2101
+ }
2102
+ };
2103
+ if (Settings.useShadow) {
2104
+ var baseSetup = DomApi.EffectiveNodesObserver.prototype._setup;
2105
+ var baseCleanup = DomApi.EffectiveNodesObserver.prototype._cleanup;
2106
+ var beforeCallListeners = DomApi.EffectiveNodesObserver.prototype._beforeCallListeners;
2107
+ Polymer.Base.extend(DomApi.EffectiveNodesObserver.prototype, {
2108
+ _setup: function () {
2109
+ if (!this._observer) {
2110
+ var self = this;
2111
+ this._mutationHandler = function (mxns) {
2112
+ if (mxns && mxns.length) {
2113
+ self._scheduleNotify();
2114
+ }
2115
+ };
2116
+ this._observer = new MutationObserver(this._mutationHandler);
2117
+ this._boundFlush = function () {
2118
+ self._flush();
2119
+ };
2120
+ Polymer.dom.addStaticFlush(this._boundFlush);
2121
+ this._observer.observe(this.node, { childList: true });
2122
+ }
2123
+ baseSetup.call(this);
2124
+ },
2125
+ _cleanup: function () {
2126
+ this._observer.disconnect();
2127
+ this._observer = null;
2128
+ this._mutationHandler = null;
2129
+ Polymer.dom.removeStaticFlush(this._boundFlush);
2130
+ baseCleanup.call(this);
2131
+ },
2132
+ _flush: function () {
2133
+ if (this._observer) {
2134
+ this._mutationHandler(this._observer.takeRecords());
2135
+ }
2136
+ },
2137
+ enableShadowAttributeTracking: function () {
2138
+ if (this._observer) {
2139
+ this._makeContentListenersAlwaysNotify();
2140
+ this._observer.disconnect();
2141
+ this._observer.observe(this.node, {
2142
+ childList: true,
2143
+ attributes: true,
2144
+ subtree: true
2145
+ });
2146
+ var root = this.domApi.getOwnerRoot();
2147
+ var host = root && root.host;
2148
+ if (host && Polymer.dom(host).observer) {
2149
+ Polymer.dom(host).observer.enableShadowAttributeTracking();
2150
+ }
2151
+ }
2152
+ },
2153
+ _makeContentListenersAlwaysNotify: function () {
2154
+ for (var i = 0, h; i < this._listeners.length; i++) {
2155
+ h = this._listeners[i];
2156
+ h._alwaysNotify = h._isContentListener;
2157
+ }
2158
+ }
2159
+ });
2160
+ }
2161
+ }());
2162
+ (function () {
2163
+ 'use strict';
2164
+ var DomApi = Polymer.DomApi.ctor;
2165
+ var Settings = Polymer.Settings;
2166
+ DomApi.DistributedNodesObserver = function (domApi) {
2167
+ DomApi.EffectiveNodesObserver.call(this, domApi);
2168
+ };
2169
+ DomApi.DistributedNodesObserver.prototype = Object.create(DomApi.EffectiveNodesObserver.prototype);
2170
+ Polymer.Base.extend(DomApi.DistributedNodesObserver.prototype, {
2171
+ _setup: function () {
2172
+ },
2173
+ _cleanup: function () {
2174
+ },
2175
+ _beforeCallListeners: function () {
2176
+ },
2177
+ _getEffectiveNodes: function () {
2178
+ return this.domApi.getDistributedNodes();
2179
+ }
2180
+ });
2181
+ if (Settings.useShadow) {
2182
+ Polymer.Base.extend(DomApi.DistributedNodesObserver.prototype, {
2183
+ _setup: function () {
2184
+ if (!this._observer) {
2185
+ var root = this.domApi.getOwnerRoot();
2186
+ var host = root && root.host;
2187
+ if (host) {
2188
+ var self = this;
2189
+ this._observer = Polymer.dom(host).observeNodes(function () {
2190
+ self._scheduleNotify();
2191
+ });
2192
+ this._observer._isContentListener = true;
2193
+ if (this._hasAttrSelect()) {
2194
+ Polymer.dom(host).observer.enableShadowAttributeTracking();
2195
+ }
2196
+ }
2197
+ }
2198
+ },
2199
+ _hasAttrSelect: function () {
2200
+ var select = this.node.getAttribute('select');
2201
+ return select && select.match(/[[.]+/);
2202
+ },
2203
+ _cleanup: function () {
2204
+ var root = this.domApi.getOwnerRoot();
2205
+ var host = root && root.host;
2206
+ if (host) {
2207
+ Polymer.dom(host).unobserveNodes(this._observer);
2208
+ }
2209
+ this._observer = null;
2210
+ }
2211
+ });
2212
+ }
2213
+ }());
2214
+ (function () {
2215
+ var hasDomApi = Polymer.DomApi.hasDomApi;
2216
+ Polymer.Base._addFeature({
2217
+ _prepShady: function () {
2218
+ this._useContent = this._useContent || Boolean(this._template);
2219
+ },
2220
+ _poolContent: function () {
2221
+ if (this._useContent) {
2222
+ saveLightChildrenIfNeeded(this);
1764
2223
  }
1765
2224
  },
1766
2225
  _setupRoot: function () {
@@ -1774,6 +2233,7 @@ upgradeLightChildren(this._lightChildren);
1774
2233
  _createLocalRoot: function () {
1775
2234
  this.shadyRoot = this.root;
1776
2235
  this.shadyRoot._distributionClean = false;
2236
+ this.shadyRoot._hasDistributed = false;
1777
2237
  this.shadyRoot._isShadyRoot = true;
1778
2238
  this.shadyRoot._dirtyRoots = [];
1779
2239
  var i$ = this.shadyRoot._insertionPoints = !this._notes || this._notes._hasContent ? this.shadyRoot.querySelectorAll('content') : [];
@@ -1824,6 +2284,7 @@ if (this._useContent) {
1824
2284
  this.shadyRoot._distributionClean = true;
1825
2285
  if (hasInsertionPoint(this.shadyRoot)) {
1826
2286
  this._composeTree();
2287
+ notifyContentObservers(this.shadyRoot);
1827
2288
  } else {
1828
2289
  if (!this.shadyRoot._hasDistributed) {
1829
2290
  this.textContent = '';
@@ -1834,6 +2295,9 @@ var children = this._composeNode(this);
1834
2295
  this._updateChildNodes(this, children);
1835
2296
  }
1836
2297
  }
2298
+ if (!this.shadyRoot._hasDistributed) {
2299
+ notifyInitialDistribution(this);
2300
+ }
1837
2301
  this.shadyRoot._hasDistributed = true;
1838
2302
  }
1839
2303
  },
@@ -2051,6 +2515,19 @@ return host.domHost;
2051
2515
  }
2052
2516
  }
2053
2517
  }
2518
+ function notifyContentObservers(root) {
2519
+ for (var i = 0, c; i < root._insertionPoints.length; i++) {
2520
+ c = root._insertionPoints[i];
2521
+ if (hasDomApi(c)) {
2522
+ Polymer.dom(c).notifyObserver();
2523
+ }
2524
+ }
2525
+ }
2526
+ function notifyInitialDistribution(host) {
2527
+ if (hasDomApi(host)) {
2528
+ Polymer.dom(host).notifyObserver();
2529
+ }
2530
+ }
2054
2531
  var needsUpgrade = window.CustomElements && !CustomElements.useNative;
2055
2532
  function upgradeLightChildren(children) {
2056
2533
  if (needsUpgrade && children) {
@@ -2083,20 +2560,23 @@ Polymer.DomModule = document.createElement('dom-module');
2083
2560
  Polymer.Base._addFeature({
2084
2561
  _registerFeatures: function () {
2085
2562
  this._prepIs();
2086
- this._prepAttributes();
2087
2563
  this._prepBehaviors();
2088
2564
  this._prepConstructor();
2089
2565
  this._prepTemplate();
2090
2566
  this._prepShady();
2567
+ this._prepPropertyInfo();
2091
2568
  },
2092
2569
  _prepBehavior: function (b) {
2093
2570
  this._addHostAttributes(b.hostAttributes);
2094
2571
  },
2095
2572
  _initFeatures: function () {
2573
+ this._registerHost();
2574
+ if (this._template) {
2096
2575
  this._poolContent();
2097
- this._pushHost();
2576
+ this._beginHosting();
2098
2577
  this._stampTemplate();
2099
- this._popHost();
2578
+ this._endHosting();
2579
+ }
2100
2580
  this._marshalHostAttributes();
2101
2581
  this._setupDebouncers();
2102
2582
  this._marshalBehaviors();
@@ -2111,35 +2591,79 @@ Polymer.Annotations = {
2111
2591
  parseAnnotations: function (template) {
2112
2592
  var list = [];
2113
2593
  var content = template._content || template.content;
2114
- this._parseNodeAnnotations(content, list);
2594
+ this._parseNodeAnnotations(content, list, template.hasAttribute('strip-whitespace'));
2115
2595
  return list;
2116
2596
  },
2117
- _parseNodeAnnotations: function (node, list) {
2118
- return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list);
2597
+ _parseNodeAnnotations: function (node, list, stripWhiteSpace) {
2598
+ return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list, stripWhiteSpace);
2599
+ },
2600
+ _bindingRegex: /([^{[]*)(\{\{|\[\[)(?!\}\}|\]\])(.+?)(?:\]\]|\}\})/g,
2601
+ _parseBindings: function (text) {
2602
+ var re = this._bindingRegex;
2603
+ var parts = [];
2604
+ var m, lastIndex;
2605
+ while ((m = re.exec(text)) !== null) {
2606
+ if (m[1]) {
2607
+ parts.push({ literal: m[1] });
2608
+ }
2609
+ var mode = m[2][0];
2610
+ var value = m[3].trim();
2611
+ var negate = false;
2612
+ if (value[0] == '!') {
2613
+ negate = true;
2614
+ value = value.substring(1).trim();
2615
+ }
2616
+ var customEvent, notifyEvent, colon;
2617
+ if (mode == '{' && (colon = value.indexOf('::')) > 0) {
2618
+ notifyEvent = value.substring(colon + 2);
2619
+ value = value.substring(0, colon);
2620
+ customEvent = true;
2621
+ }
2622
+ parts.push({
2623
+ compoundIndex: parts.length,
2624
+ value: value,
2625
+ mode: mode,
2626
+ negate: negate,
2627
+ event: notifyEvent,
2628
+ customEvent: customEvent
2629
+ });
2630
+ lastIndex = re.lastIndex;
2631
+ }
2632
+ if (lastIndex && lastIndex < text.length) {
2633
+ var literal = text.substring(lastIndex);
2634
+ if (literal) {
2635
+ parts.push({ literal: literal });
2636
+ }
2637
+ }
2638
+ if (parts.length) {
2639
+ return parts;
2640
+ }
2119
2641
  },
2120
- _testEscape: function (value) {
2121
- var escape = value.slice(0, 2);
2122
- if (escape === '{{' || escape === '[[') {
2123
- return escape;
2642
+ _literalFromParts: function (parts) {
2643
+ var s = '';
2644
+ for (var i = 0; i < parts.length; i++) {
2645
+ var literal = parts[i].literal;
2646
+ s += literal || '';
2124
2647
  }
2648
+ return s;
2125
2649
  },
2126
2650
  _parseTextNodeAnnotation: function (node, list) {
2127
- var v = node.textContent;
2128
- var escape = this._testEscape(v);
2129
- if (escape) {
2130
- node.textContent = ' ';
2651
+ var parts = this._parseBindings(node.textContent);
2652
+ if (parts) {
2653
+ node.textContent = this._literalFromParts(parts) || ' ';
2131
2654
  var annote = {
2132
2655
  bindings: [{
2133
2656
  kind: 'text',
2134
- mode: escape[0],
2135
- value: v.slice(2, -2).trim()
2657
+ name: 'textContent',
2658
+ parts: parts,
2659
+ isCompound: parts.length !== 1
2136
2660
  }]
2137
2661
  };
2138
2662
  list.push(annote);
2139
2663
  return annote;
2140
2664
  }
2141
2665
  },
2142
- _parseElementAnnotations: function (element, list) {
2666
+ _parseElementAnnotations: function (element, list, stripWhiteSpace) {
2143
2667
  var annote = {
2144
2668
  bindings: [],
2145
2669
  events: []
@@ -2147,7 +2671,7 @@ events: []
2147
2671
  if (element.localName === 'content') {
2148
2672
  list._hasContent = true;
2149
2673
  }
2150
- this._parseChildNodesAnnotations(element, annote, list);
2674
+ this._parseChildNodesAnnotations(element, annote, list, stripWhiteSpace);
2151
2675
  if (element.attributes) {
2152
2676
  this._parseNodeAttributeAnnotations(element, annote, list);
2153
2677
  if (this.prepElement) {
@@ -2159,26 +2683,38 @@ list.push(annote);
2159
2683
  }
2160
2684
  return annote;
2161
2685
  },
2162
- _parseChildNodesAnnotations: function (root, annote, list, callback) {
2686
+ _parseChildNodesAnnotations: function (root, annote, list, stripWhiteSpace) {
2163
2687
  if (root.firstChild) {
2164
- for (var i = 0, node = root.firstChild; node; node = node.nextSibling, i++) {
2688
+ var node = root.firstChild;
2689
+ var i = 0;
2690
+ while (node) {
2691
+ var next = node.nextSibling;
2165
2692
  if (node.localName === 'template' && !node.hasAttribute('preserve-content')) {
2166
2693
  this._parseTemplate(node, i, list, annote);
2167
2694
  }
2168
2695
  if (node.nodeType === Node.TEXT_NODE) {
2169
- var n = node.nextSibling;
2696
+ var n = next;
2170
2697
  while (n && n.nodeType === Node.TEXT_NODE) {
2171
2698
  node.textContent += n.textContent;
2699
+ next = n.nextSibling;
2172
2700
  root.removeChild(n);
2173
- n = n.nextSibling;
2701
+ n = next;
2702
+ }
2703
+ if (stripWhiteSpace && !node.textContent.trim()) {
2704
+ root.removeChild(node);
2705
+ i--;
2174
2706
  }
2175
2707
  }
2176
- var childAnnotation = this._parseNodeAnnotations(node, list, callback);
2708
+ if (node.parentNode) {
2709
+ var childAnnotation = this._parseNodeAnnotations(node, list, stripWhiteSpace);
2177
2710
  if (childAnnotation) {
2178
2711
  childAnnotation.parent = annote;
2179
2712
  childAnnotation.index = i;
2180
2713
  }
2181
2714
  }
2715
+ node = next;
2716
+ i++;
2717
+ }
2182
2718
  }
2183
2719
  },
2184
2720
  _parseTemplate: function (node, index, list, parent) {
@@ -2194,62 +2730,50 @@ index: index
2194
2730
  });
2195
2731
  },
2196
2732
  _parseNodeAttributeAnnotations: function (node, annotation) {
2197
- for (var i = node.attributes.length - 1, a; a = node.attributes[i]; i--) {
2198
- var n = a.name, v = a.value;
2199
- if (n === 'id' && !this._testEscape(v)) {
2200
- annotation.id = v;
2201
- } else if (n.slice(0, 3) === 'on-') {
2733
+ var attrs = Array.prototype.slice.call(node.attributes);
2734
+ for (var i = attrs.length - 1, a; a = attrs[i]; i--) {
2735
+ var n = a.name;
2736
+ var v = a.value;
2737
+ var b;
2738
+ if (n.slice(0, 3) === 'on-') {
2202
2739
  node.removeAttribute(n);
2203
2740
  annotation.events.push({
2204
2741
  name: n.slice(3),
2205
2742
  value: v
2206
2743
  });
2207
- } else {
2208
- var b = this._parseNodeAttributeAnnotation(node, n, v);
2209
- if (b) {
2744
+ } else if (b = this._parseNodeAttributeAnnotation(node, n, v)) {
2210
2745
  annotation.bindings.push(b);
2211
- }
2746
+ } else if (n === 'id') {
2747
+ annotation.id = v;
2212
2748
  }
2213
2749
  }
2214
2750
  },
2215
- _parseNodeAttributeAnnotation: function (node, n, v) {
2216
- var escape = this._testEscape(v);
2217
- if (escape) {
2218
- var customEvent;
2219
- var name = n;
2220
- var mode = escape[0];
2221
- v = v.slice(2, -2).trim();
2222
- var not = false;
2223
- if (v[0] == '!') {
2224
- v = v.substring(1);
2225
- not = true;
2226
- }
2751
+ _parseNodeAttributeAnnotation: function (node, name, value) {
2752
+ var parts = this._parseBindings(value);
2753
+ if (parts) {
2754
+ var origName = name;
2227
2755
  var kind = 'property';
2228
- if (n[n.length - 1] == '$') {
2229
- name = n.slice(0, -1);
2756
+ if (name[name.length - 1] == '$') {
2757
+ name = name.slice(0, -1);
2230
2758
  kind = 'attribute';
2231
2759
  }
2232
- var notifyEvent, colon;
2233
- if (mode == '{' && (colon = v.indexOf('::')) > 0) {
2234
- notifyEvent = v.substring(colon + 2);
2235
- v = v.substring(0, colon);
2236
- customEvent = true;
2760
+ var literal = this._literalFromParts(parts);
2761
+ if (literal && kind == 'attribute') {
2762
+ node.setAttribute(name, literal);
2237
2763
  }
2238
- if (node.localName == 'input' && n == 'value') {
2239
- node.setAttribute(n, '');
2764
+ if (node.localName == 'input' && name == 'value') {
2765
+ node.setAttribute(origName, '');
2240
2766
  }
2241
- node.removeAttribute(n);
2767
+ node.removeAttribute(origName);
2242
2768
  if (kind === 'property') {
2243
2769
  name = Polymer.CaseMap.dashToCamelCase(name);
2244
2770
  }
2245
2771
  return {
2246
2772
  kind: kind,
2247
- mode: mode,
2248
2773
  name: name,
2249
- value: v,
2250
- negate: not,
2251
- event: notifyEvent,
2252
- customEvent: customEvent
2774
+ parts: parts,
2775
+ literal: literal,
2776
+ isCompound: parts.length !== 1
2253
2777
  };
2254
2778
  }
2255
2779
  },
@@ -2325,7 +2849,10 @@ _prepAnnotations: function () {
2325
2849
  if (!this._template) {
2326
2850
  this._notes = [];
2327
2851
  } else {
2328
- Polymer.Annotations.prepElement = this._prepElement.bind(this);
2852
+ var self = this;
2853
+ Polymer.Annotations.prepElement = function (element) {
2854
+ self._prepElement(element);
2855
+ };
2329
2856
  if (this._template._content && this._template._content._notes) {
2330
2857
  this._notes = this._template._content._notes;
2331
2858
  } else {
@@ -2340,9 +2867,14 @@ for (var i = 0; i < notes.length; i++) {
2340
2867
  var note = notes[i];
2341
2868
  for (var j = 0; j < note.bindings.length; j++) {
2342
2869
  var b = note.bindings[j];
2343
- b.signature = this._parseMethod(b.value);
2344
- if (!b.signature) {
2345
- b.model = this._modelForPath(b.value);
2870
+ for (var k = 0; k < b.parts.length; k++) {
2871
+ var p = b.parts[k];
2872
+ if (!p.literal) {
2873
+ p.signature = this._parseMethod(p.value);
2874
+ if (!p.signature) {
2875
+ p.model = this._modelForPath(p.value);
2876
+ }
2877
+ }
2346
2878
  }
2347
2879
  }
2348
2880
  if (note.templateContent) {
@@ -2353,10 +2885,12 @@ for (var prop in pp) {
2353
2885
  bindings.push({
2354
2886
  index: note.index,
2355
2887
  kind: 'property',
2356
- mode: '{',
2357
2888
  name: '_parent_' + prop,
2889
+ parts: [{
2890
+ mode: '{',
2358
2891
  model: prop,
2359
2892
  value: prop
2893
+ }]
2360
2894
  });
2361
2895
  }
2362
2896
  note.bindings = note.bindings.concat(bindings);
@@ -2365,22 +2899,24 @@ note.bindings = note.bindings.concat(bindings);
2365
2899
  },
2366
2900
  _discoverTemplateParentProps: function (notes) {
2367
2901
  var pp = {};
2368
- notes.forEach(function (n) {
2369
- n.bindings.forEach(function (b) {
2370
- if (b.signature) {
2371
- var args = b.signature.args;
2372
- for (var k = 0; k < args.length; k++) {
2373
- pp[args[k].model] = true;
2902
+ for (var i = 0, n; i < notes.length && (n = notes[i]); i++) {
2903
+ for (var j = 0, b$ = n.bindings, b; j < b$.length && (b = b$[j]); j++) {
2904
+ for (var k = 0, p$ = b.parts, p; k < p$.length && (p = p$[k]); k++) {
2905
+ if (p.signature) {
2906
+ var args = p.signature.args;
2907
+ for (var kk = 0; kk < args.length; kk++) {
2908
+ pp[args[kk].model] = true;
2374
2909
  }
2375
2910
  } else {
2376
- pp[b.model] = true;
2911
+ pp[p.model] = true;
2912
+ }
2913
+ }
2377
2914
  }
2378
- });
2379
2915
  if (n.templateContent) {
2380
2916
  var tpp = n.templateContent._parentProps;
2381
2917
  Polymer.Base.mixin(pp, tpp);
2382
2918
  }
2383
- });
2919
+ }
2384
2920
  return pp;
2385
2921
  },
2386
2922
  _prepElement: function (element) {
@@ -2394,60 +2930,98 @@ this._marshalAnnotatedNodes();
2394
2930
  this._marshalAnnotatedListeners();
2395
2931
  }
2396
2932
  },
2397
- _configureAnnotationReferences: function () {
2398
- this._configureTemplateContent();
2933
+ _configureAnnotationReferences: function (config) {
2934
+ var notes = this._notes;
2935
+ var nodes = this._nodes;
2936
+ for (var i = 0; i < notes.length; i++) {
2937
+ var note = notes[i];
2938
+ var node = nodes[i];
2939
+ this._configureTemplateContent(note, node);
2940
+ this._configureCompoundBindings(note, node);
2941
+ }
2399
2942
  },
2400
- _configureTemplateContent: function () {
2401
- this._notes.forEach(function (note, i) {
2943
+ _configureTemplateContent: function (note, node) {
2402
2944
  if (note.templateContent) {
2403
- this._nodes[i]._content = note.templateContent;
2945
+ node._content = note.templateContent;
2946
+ }
2947
+ },
2948
+ _configureCompoundBindings: function (note, node) {
2949
+ var bindings = note.bindings;
2950
+ for (var i = 0; i < bindings.length; i++) {
2951
+ var binding = bindings[i];
2952
+ if (binding.isCompound) {
2953
+ var storage = node.__compoundStorage__ || (node.__compoundStorage__ = {});
2954
+ var parts = binding.parts;
2955
+ var literals = new Array(parts.length);
2956
+ for (var j = 0; j < parts.length; j++) {
2957
+ literals[j] = parts[j].literal;
2958
+ }
2959
+ var name = binding.name;
2960
+ storage[name] = literals;
2961
+ if (binding.literal && binding.kind == 'property') {
2962
+ if (node._configValue) {
2963
+ node._configValue(name, binding.literal);
2964
+ } else {
2965
+ node[name] = binding.literal;
2966
+ }
2967
+ }
2968
+ }
2404
2969
  }
2405
- }, this);
2406
2970
  },
2407
2971
  _marshalIdNodes: function () {
2408
2972
  this.$ = {};
2409
- this._notes.forEach(function (a) {
2973
+ for (var i = 0, l = this._notes.length, a; i < l && (a = this._notes[i]); i++) {
2410
2974
  if (a.id) {
2411
2975
  this.$[a.id] = this._findAnnotatedNode(this.root, a);
2412
2976
  }
2413
- }, this);
2977
+ }
2414
2978
  },
2415
2979
  _marshalAnnotatedNodes: function () {
2416
- if (this._nodes) {
2417
- this._nodes = this._nodes.map(function (a) {
2418
- return this._findAnnotatedNode(this.root, a);
2419
- }, this);
2980
+ if (this._notes && this._notes.length) {
2981
+ var r = new Array(this._notes.length);
2982
+ for (var i = 0; i < this._notes.length; i++) {
2983
+ r[i] = this._findAnnotatedNode(this.root, this._notes[i]);
2984
+ }
2985
+ this._nodes = r;
2420
2986
  }
2421
2987
  },
2422
2988
  _marshalAnnotatedListeners: function () {
2423
- this._notes.forEach(function (a) {
2989
+ for (var i = 0, l = this._notes.length, a; i < l && (a = this._notes[i]); i++) {
2424
2990
  if (a.events && a.events.length) {
2425
2991
  var node = this._findAnnotatedNode(this.root, a);
2426
- a.events.forEach(function (e) {
2992
+ for (var j = 0, e$ = a.events, e; j < e$.length && (e = e$[j]); j++) {
2427
2993
  this.listen(node, e.name, e.value);
2428
- }, this);
2429
2994
  }
2430
- }, this);
2995
+ }
2996
+ }
2431
2997
  }
2432
2998
  });
2433
2999
  Polymer.Base._addFeature({
2434
3000
  listeners: {},
2435
3001
  _listenListeners: function (listeners) {
2436
- var node, name, key;
2437
- for (key in listeners) {
2438
- if (key.indexOf('.') < 0) {
3002
+ var node, name, eventName;
3003
+ for (eventName in listeners) {
3004
+ if (eventName.indexOf('.') < 0) {
2439
3005
  node = this;
2440
- name = key;
3006
+ name = eventName;
2441
3007
  } else {
2442
- name = key.split('.');
3008
+ name = eventName.split('.');
2443
3009
  node = this.$[name[0]];
2444
3010
  name = name[1];
2445
3011
  }
2446
- this.listen(node, name, listeners[key]);
3012
+ this.listen(node, name, listeners[eventName]);
2447
3013
  }
2448
3014
  },
2449
3015
  listen: function (node, eventName, methodName) {
2450
- this._listen(node, eventName, this._createEventHandler(node, eventName, methodName));
3016
+ var handler = this._recallEventHandler(this, eventName, node, methodName);
3017
+ if (!handler) {
3018
+ handler = this._createEventHandler(node, eventName, methodName);
3019
+ }
3020
+ if (handler._listening) {
3021
+ return;
3022
+ }
3023
+ this._listen(node, eventName, handler);
3024
+ handler._listening = true;
2451
3025
  },
2452
3026
  _boundListenerKey: function (eventName, methodName) {
2453
3027
  return eventName + ':' + methodName;
@@ -2486,6 +3060,7 @@ host[methodName](e, e.detail);
2486
3060
  host._warn(host._logf('_createEventHandler', 'listener method `' + methodName + '` not defined'));
2487
3061
  }
2488
3062
  };
3063
+ handler._listening = false;
2489
3064
  this._recordEventHandler(host, eventName, node, methodName, handler);
2490
3065
  return handler;
2491
3066
  },
@@ -2493,6 +3068,7 @@ unlisten: function (node, eventName, methodName) {
2493
3068
  var handler = this._recallEventHandler(this, eventName, node, methodName);
2494
3069
  if (handler) {
2495
3070
  this._unlisten(node, eventName, handler);
3071
+ handler._listening = false;
2496
3072
  }
2497
3073
  },
2498
3074
  _listen: function (node, eventName, handler) {
@@ -2504,6 +3080,7 @@ node.removeEventListener(eventName, handler);
2504
3080
  });
2505
3081
  (function () {
2506
3082
  'use strict';
3083
+ var wrap = Polymer.DomApi.wrap;
2507
3084
  var HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string';
2508
3085
  var GESTURE_KEY = '__polymerGestures';
2509
3086
  var HANDLED_OBJ = '__polymerGesturesHandled';
@@ -2654,8 +3231,11 @@ return ev.target;
2654
3231
  handleNative: function (ev) {
2655
3232
  var handled;
2656
3233
  var type = ev.type;
2657
- var node = ev.currentTarget;
3234
+ var node = wrap(ev.currentTarget);
2658
3235
  var gobj = node[GESTURE_KEY];
3236
+ if (!gobj) {
3237
+ return;
3238
+ }
2659
3239
  var gs = gobj[type];
2660
3240
  if (!gs) {
2661
3241
  return;
@@ -2738,6 +3318,7 @@ Gestures.prevent('track');
2738
3318
  }
2739
3319
  },
2740
3320
  add: function (node, evType, handler) {
3321
+ node = wrap(node);
2741
3322
  var recognizer = this.gestures[evType];
2742
3323
  var deps = recognizer.deps;
2743
3324
  var name = recognizer.name;
@@ -2766,6 +3347,7 @@ this.setTouchAction(node, recognizer.touchAction);
2766
3347
  }
2767
3348
  },
2768
3349
  remove: function (node, evType, handler) {
3350
+ node = wrap(node);
2769
3351
  var recognizer = this.gestures[evType];
2770
3352
  var deps = recognizer.deps;
2771
3353
  var name = recognizer.name;
@@ -2892,7 +3474,9 @@ Gestures.fire(target, type, {
2892
3474
  x: event.clientX,
2893
3475
  y: event.clientY,
2894
3476
  sourceEvent: event,
2895
- prevent: Gestures.prevent.bind(Gestures)
3477
+ prevent: function (e) {
3478
+ return Gestures.prevent(e);
3479
+ }
2896
3480
  });
2897
3481
  }
2898
3482
  });
@@ -3184,12 +3768,17 @@ this._callbacks.splice(0, len);
3184
3768
  this._lastVal += len;
3185
3769
  }
3186
3770
  };
3187
- new (window.MutationObserver || JsMutationObserver)(Polymer.Async._atEndOfMicrotask.bind(Polymer.Async)).observe(Polymer.Async._twiddle, { characterData: true });
3771
+ new window.MutationObserver(function () {
3772
+ Polymer.Async._atEndOfMicrotask();
3773
+ }).observe(Polymer.Async._twiddle, { characterData: true });
3188
3774
  Polymer.Debounce = function () {
3189
3775
  var Async = Polymer.Async;
3190
3776
  var Debouncer = function (context) {
3191
3777
  this.context = context;
3192
- this.boundComplete = this.complete.bind(this);
3778
+ var self = this;
3779
+ this.boundComplete = function () {
3780
+ self.complete();
3781
+ };
3193
3782
  };
3194
3783
  Debouncer.prototype = {
3195
3784
  go: function (callback, wait) {
@@ -3266,6 +3855,32 @@ if (toElement) {
3266
3855
  Polymer.dom(toElement).setAttribute(name, '');
3267
3856
  }
3268
3857
  },
3858
+ getEffectiveChildNodes: function () {
3859
+ return Polymer.dom(this).getEffectiveChildNodes();
3860
+ },
3861
+ getEffectiveChildren: function () {
3862
+ var list = Polymer.dom(this).getEffectiveChildNodes();
3863
+ return list.filter(function (n) {
3864
+ return n.nodeType === Node.ELEMENT_NODE;
3865
+ });
3866
+ },
3867
+ getEffectiveTextContent: function () {
3868
+ var cn = this.getEffectiveChildNodes();
3869
+ var tc = [];
3870
+ for (var i = 0, c; c = cn[i]; i++) {
3871
+ if (c.nodeType !== Node.COMMENT_NODE) {
3872
+ tc.push(Polymer.dom(c).textContent);
3873
+ }
3874
+ }
3875
+ return tc.join('');
3876
+ },
3877
+ queryEffectiveChildren: function (slctr) {
3878
+ var e$ = Polymer.dom(this).queryDistributedElements(slctr);
3879
+ return e$ && e$[0];
3880
+ },
3881
+ queryAllEffectiveChildren: function (slctr) {
3882
+ return Polymer.dom(this).queryDistributedElements(slctr);
3883
+ },
3269
3884
  getContentChildNodes: function (slctr) {
3270
3885
  var content = Polymer.dom(this.root).querySelector(slctr || 'content');
3271
3886
  return content ? Polymer.dom(content).getDistributedNodes() : [];
@@ -3278,19 +3893,37 @@ return n.nodeType === Node.ELEMENT_NODE;
3278
3893
  fire: function (type, detail, options) {
3279
3894
  options = options || Polymer.nob;
3280
3895
  var node = options.node || this;
3281
- var detail = detail === null || detail === undefined ? Polymer.nob : detail;
3896
+ var detail = detail === null || detail === undefined ? {} : detail;
3282
3897
  var bubbles = options.bubbles === undefined ? true : options.bubbles;
3283
3898
  var cancelable = Boolean(options.cancelable);
3284
- var event = new CustomEvent(type, {
3899
+ var useCache = options._useCache;
3900
+ var event = this._getEvent(type, bubbles, cancelable, useCache);
3901
+ event.detail = detail;
3902
+ if (useCache) {
3903
+ this.__eventCache[type] = null;
3904
+ }
3905
+ node.dispatchEvent(event);
3906
+ if (useCache) {
3907
+ this.__eventCache[type] = event;
3908
+ }
3909
+ return event;
3910
+ },
3911
+ __eventCache: {},
3912
+ _getEvent: function (type, bubbles, cancelable, useCache) {
3913
+ var event = useCache && this.__eventCache[type];
3914
+ if (!event || (event.bubbles != bubbles || event.cancelable != cancelable)) {
3915
+ event = new Event(type, {
3285
3916
  bubbles: Boolean(bubbles),
3286
- cancelable: cancelable,
3287
- detail: detail
3917
+ cancelable: cancelable
3288
3918
  });
3289
- node.dispatchEvent(event);
3919
+ }
3290
3920
  return event;
3291
3921
  },
3292
3922
  async: function (callback, waitTime) {
3293
- return Polymer.Async.run(callback.bind(this), waitTime);
3923
+ var self = this;
3924
+ return Polymer.Async.run(function () {
3925
+ callback.call(self);
3926
+ }, waitTime);
3294
3927
  },
3295
3928
  cancelAsync: function (handle) {
3296
3929
  Polymer.Async.cancel(handle);
@@ -3303,7 +3936,7 @@ if (index >= 0) {
3303
3936
  return path.splice(index, 1);
3304
3937
  }
3305
3938
  } else {
3306
- var arr = this.get(path);
3939
+ var arr = this._get(path);
3307
3940
  index = arr.indexOf(item);
3308
3941
  if (index >= 0) {
3309
3942
  return this.splice(path, index, 1);
@@ -3323,11 +3956,16 @@ importHref: function (href, onload, onerror) {
3323
3956
  var l = document.createElement('link');
3324
3957
  l.rel = 'import';
3325
3958
  l.href = href;
3959
+ var self = this;
3326
3960
  if (onload) {
3327
- l.onload = onload.bind(this);
3961
+ l.onload = function (e) {
3962
+ return onload.call(self, e);
3963
+ };
3328
3964
  }
3329
3965
  if (onerror) {
3330
- l.onerror = onerror.bind(this);
3966
+ l.onerror = function (e) {
3967
+ return onerror.call(self, e);
3968
+ };
3331
3969
  }
3332
3970
  document.head.appendChild(l);
3333
3971
  return l;
@@ -3340,20 +3978,27 @@ elt[n] = props[n];
3340
3978
  }
3341
3979
  }
3342
3980
  return elt;
3981
+ },
3982
+ isLightDescendant: function (node) {
3983
+ return this !== node && this.contains(node) && Polymer.dom(this).getOwnerRoot() === Polymer.dom(node).getOwnerRoot();
3984
+ },
3985
+ isLocalDescendant: function (node) {
3986
+ return this.root === Polymer.dom(node).getOwnerRoot();
3343
3987
  }
3344
3988
  });
3345
3989
  Polymer.Bind = {
3990
+ _dataEventCache: {},
3346
3991
  prepareModel: function (model) {
3347
- model._propertyEffects = {};
3348
- model._bindListeners = [];
3349
3992
  Polymer.Base.mixin(model, this._modelApi);
3350
3993
  },
3351
3994
  _modelApi: {
3352
- _notifyChange: function (property) {
3353
- var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
3354
- Polymer.Base.fire(eventName, { value: this[property] }, {
3995
+ _notifyChange: function (source, event, value) {
3996
+ value = value === undefined ? this[source] : value;
3997
+ event = event || Polymer.CaseMap.camelToDashCase(source) + '-changed';
3998
+ this.fire(event, { value: value }, {
3355
3999
  bubbles: false,
3356
- node: this
4000
+ cancelable: false,
4001
+ _useCache: true
3357
4002
  });
3358
4003
  },
3359
4004
  _propertySetter: function (property, value, effects, fromAbove) {
@@ -3382,12 +4027,9 @@ node[property] = value;
3382
4027
  }
3383
4028
  },
3384
4029
  _effectEffects: function (property, value, effects, old, fromAbove) {
3385
- effects.forEach(function (fx) {
3386
- var fn = Polymer.Bind['_' + fx.kind + 'Effect'];
3387
- if (fn) {
3388
- fn.call(this, property, value, fx.effect, old, fromAbove);
4030
+ for (var i = 0, l = effects.length, fx; i < l && (fx = effects[i]); i++) {
4031
+ fx.fn.call(this, property, value, fx.effect, old, fromAbove);
3389
4032
  }
3390
- }, this);
3391
4033
  },
3392
4034
  _clearPath: function (path) {
3393
4035
  for (var prop in this.__data__) {
@@ -3398,6 +4040,9 @@ this.__data__[prop] = undefined;
3398
4040
  }
3399
4041
  },
3400
4042
  ensurePropertyEffects: function (model, property) {
4043
+ if (!model._propertyEffects) {
4044
+ model._propertyEffects = {};
4045
+ }
3401
4046
  var fx = model._propertyEffects[property];
3402
4047
  if (!fx) {
3403
4048
  fx = model._propertyEffects[property] = [];
@@ -3406,10 +4051,13 @@ return fx;
3406
4051
  },
3407
4052
  addPropertyEffect: function (model, property, kind, effect) {
3408
4053
  var fx = this.ensurePropertyEffects(model, property);
3409
- fx.push({
4054
+ var propEffect = {
3410
4055
  kind: kind,
3411
- effect: effect
3412
- });
4056
+ effect: effect,
4057
+ fn: Polymer.Bind['_' + kind + 'Effect']
4058
+ };
4059
+ fx.push(propEffect);
4060
+ return propEffect;
3413
4061
  },
3414
4062
  createBindings: function (model) {
3415
4063
  var fx$ = model._propertyEffects;
@@ -3459,7 +4107,10 @@ upper: function (name) {
3459
4107
  return name[0].toUpperCase() + name.substring(1);
3460
4108
  },
3461
4109
  _addAnnotatedListener: function (model, index, property, path, event) {
3462
- var fn = this._notedListenerFactory(property, path, this._isStructured(path), this._isEventBogus);
4110
+ if (!model._bindListeners) {
4111
+ model._bindListeners = [];
4112
+ }
4113
+ var fn = this._notedListenerFactory(property, path, this._isStructured(path));
3463
4114
  var eventName = event || Polymer.CaseMap.camelToDashCase(property) + '-changed';
3464
4115
  model._bindListeners.push({
3465
4116
  index: index,
@@ -3475,54 +4126,59 @@ return path.indexOf('.') > 0;
3475
4126
  _isEventBogus: function (e, target) {
3476
4127
  return e.path && e.path[0] !== target;
3477
4128
  },
3478
- _notedListenerFactory: function (property, path, isStructured, bogusTest) {
3479
- return function (e, target) {
3480
- if (!bogusTest(e, target)) {
3481
- if (e.detail && e.detail.path) {
3482
- this.notifyPath(this._fixPath(path, property, e.detail.path), e.detail.value);
4129
+ _notedListenerFactory: function (property, path, isStructured) {
4130
+ return function (target, value, targetPath) {
4131
+ if (targetPath) {
4132
+ this._notifyPath(this._fixPath(path, property, targetPath), value);
3483
4133
  } else {
3484
- var value = target[property];
4134
+ value = target[property];
3485
4135
  if (!isStructured) {
3486
- this[path] = target[property];
4136
+ this[path] = value;
3487
4137
  } else {
3488
4138
  if (this.__data__[path] != value) {
3489
4139
  this.set(path, value);
3490
4140
  }
3491
4141
  }
3492
4142
  }
3493
- }
3494
4143
  };
3495
4144
  },
3496
4145
  prepareInstance: function (inst) {
3497
4146
  inst.__data__ = Object.create(null);
3498
4147
  },
3499
4148
  setupBindListeners: function (inst) {
3500
- inst._bindListeners.forEach(function (info) {
4149
+ var b$ = inst._bindListeners;
4150
+ for (var i = 0, l = b$.length, info; i < l && (info = b$[i]); i++) {
3501
4151
  var node = inst._nodes[info.index];
3502
- node.addEventListener(info.event, inst._notifyListener.bind(inst, info.changedFn));
4152
+ this._addNotifyListener(node, inst, info.event, info.changedFn);
4153
+ }
4154
+ ;
4155
+ },
4156
+ _addNotifyListener: function (element, context, event, changedFn) {
4157
+ element.addEventListener(event, function (e) {
4158
+ return context._notifyListener(changedFn, e);
3503
4159
  });
3504
4160
  }
3505
4161
  };
3506
4162
  Polymer.Base.extend(Polymer.Bind, {
3507
4163
  _shouldAddListener: function (effect) {
3508
- return effect.name && effect.mode === '{' && !effect.negate && effect.kind != 'attribute';
4164
+ return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !effect.isCompound && effect.parts[0].mode === '{' && !effect.parts[0].negate;
3509
4165
  },
3510
4166
  _annotationEffect: function (source, value, effect) {
3511
4167
  if (source != effect.value) {
3512
- value = this.get(effect.value);
4168
+ value = this._get(effect.value);
3513
4169
  this.__data__[effect.value] = value;
3514
4170
  }
3515
4171
  var calc = effect.negate ? !value : value;
3516
4172
  if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) {
3517
- return this._applyEffectValue(calc, effect);
4173
+ return this._applyEffectValue(effect, calc);
3518
4174
  }
3519
4175
  },
3520
- _reflectEffect: function (source) {
3521
- this.reflectPropertyToAttribute(source);
4176
+ _reflectEffect: function (source, value, effect) {
4177
+ this.reflectPropertyToAttribute(source, effect.attribute, value);
3522
4178
  },
3523
4179
  _notifyEffect: function (source, value, effect, old, fromAbove) {
3524
4180
  if (!fromAbove) {
3525
- this._notifyChange(source);
4181
+ this._notifyChange(source, effect.event, value);
3526
4182
  }
3527
4183
  },
3528
4184
  _functionEffect: function (source, value, fn, old, fromAbove) {
@@ -3552,7 +4208,7 @@ var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
3552
4208
  if (args) {
3553
4209
  var fn = this[effect.method];
3554
4210
  if (fn) {
3555
- this.__setProperty(effect.property, fn.apply(this, args));
4211
+ this.__setProperty(effect.name, fn.apply(this, args));
3556
4212
  } else {
3557
4213
  this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined'));
3558
4214
  }
@@ -3568,7 +4224,7 @@ var computedvalue = fn.apply(computedHost, args);
3568
4224
  if (effect.negate) {
3569
4225
  computedvalue = !computedvalue;
3570
4226
  }
3571
- this._applyEffectValue(computedvalue, effect);
4227
+ this._applyEffectValue(effect, computedvalue);
3572
4228
  }
3573
4229
  } else {
3574
4230
  computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute method `' + effect.method + '` not defined'));
@@ -3584,7 +4240,7 @@ var v;
3584
4240
  if (arg.literal) {
3585
4241
  v = arg.value;
3586
4242
  } else if (arg.structured) {
3587
- v = Polymer.Base.get(name, model);
4243
+ v = Polymer.Base._get(name, model);
3588
4244
  } else {
3589
4245
  v = model[name];
3590
4246
  }
@@ -3608,7 +4264,8 @@ return values;
3608
4264
  });
3609
4265
  Polymer.Base._addFeature({
3610
4266
  _addPropertyEffect: function (property, kind, effect) {
3611
- Polymer.Bind.addPropertyEffect(this, property, kind, effect);
4267
+ var prop = Polymer.Bind.addPropertyEffect(this, property, kind, effect);
4268
+ prop.pathFn = this['_' + prop.kind + 'PathEffect'];
3612
4269
  },
3613
4270
  _prepEffects: function () {
3614
4271
  Polymer.Bind.prepareModel(this);
@@ -3629,10 +4286,10 @@ prop.readOnly = true;
3629
4286
  this._addComputedEffect(p, prop.computed);
3630
4287
  }
3631
4288
  if (prop.notify) {
3632
- this._addPropertyEffect(p, 'notify');
4289
+ this._addPropertyEffect(p, 'notify', { event: Polymer.CaseMap.camelToDashCase(p) + '-changed' });
3633
4290
  }
3634
4291
  if (prop.reflectToAttribute) {
3635
- this._addPropertyEffect(p, 'reflect');
4292
+ this._addPropertyEffect(p, 'reflect', { attribute: Polymer.CaseMap.camelToDashCase(p) });
3636
4293
  }
3637
4294
  if (prop.readOnly) {
3638
4295
  Polymer.Bind.ensurePropertyEffects(this, p);
@@ -3642,14 +4299,14 @@ Polymer.Bind.ensurePropertyEffects(this, p);
3642
4299
  },
3643
4300
  _addComputedEffect: function (name, expression) {
3644
4301
  var sig = this._parseMethod(expression);
3645
- sig.args.forEach(function (arg) {
4302
+ for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
3646
4303
  this._addPropertyEffect(arg.model, 'compute', {
3647
4304
  method: sig.method,
3648
4305
  args: sig.args,
3649
4306
  trigger: arg,
3650
- property: name
4307
+ name: name
3651
4308
  });
3652
- }, this);
4309
+ }
3653
4310
  },
3654
4311
  _addObserverEffect: function (property, observer) {
3655
4312
  this._addPropertyEffect(property, 'observer', {
@@ -3659,61 +4316,74 @@ property: property
3659
4316
  },
3660
4317
  _addComplexObserverEffects: function (observers) {
3661
4318
  if (observers) {
3662
- observers.forEach(function (observer) {
3663
- this._addComplexObserverEffect(observer);
3664
- }, this);
4319
+ for (var i = 0, o; i < observers.length && (o = observers[i]); i++) {
4320
+ this._addComplexObserverEffect(o);
4321
+ }
3665
4322
  }
3666
4323
  },
3667
4324
  _addComplexObserverEffect: function (observer) {
3668
4325
  var sig = this._parseMethod(observer);
3669
- sig.args.forEach(function (arg) {
4326
+ for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
3670
4327
  this._addPropertyEffect(arg.model, 'complexObserver', {
3671
4328
  method: sig.method,
3672
4329
  args: sig.args,
3673
4330
  trigger: arg
3674
4331
  });
3675
- }, this);
4332
+ }
3676
4333
  },
3677
4334
  _addAnnotationEffects: function (notes) {
3678
- this._nodes = [];
3679
- notes.forEach(function (note) {
3680
- var index = this._nodes.push(note) - 1;
3681
- note.bindings.forEach(function (binding) {
3682
- this._addAnnotationEffect(binding, index);
3683
- }, this);
3684
- }, this);
4335
+ for (var i = 0, note; i < notes.length && (note = notes[i]); i++) {
4336
+ var b$ = note.bindings;
4337
+ for (var j = 0, binding; j < b$.length && (binding = b$[j]); j++) {
4338
+ this._addAnnotationEffect(binding, i);
4339
+ }
4340
+ }
3685
4341
  },
3686
4342
  _addAnnotationEffect: function (note, index) {
3687
4343
  if (Polymer.Bind._shouldAddListener(note)) {
3688
- Polymer.Bind._addAnnotatedListener(this, index, note.name, note.value, note.event);
4344
+ Polymer.Bind._addAnnotatedListener(this, index, note.name, note.parts[0].value, note.parts[0].event);
4345
+ }
4346
+ for (var i = 0; i < note.parts.length; i++) {
4347
+ var part = note.parts[i];
4348
+ if (part.signature) {
4349
+ this._addAnnotatedComputationEffect(note, part, index);
4350
+ } else if (!part.literal) {
4351
+ this._addPropertyEffect(part.model, 'annotation', {
4352
+ kind: note.kind,
4353
+ index: index,
4354
+ name: note.name,
4355
+ value: part.value,
4356
+ isCompound: note.isCompound,
4357
+ compoundIndex: part.compoundIndex,
4358
+ event: part.event,
4359
+ customEvent: part.customEvent,
4360
+ negate: part.negate
4361
+ });
3689
4362
  }
3690
- if (note.signature) {
3691
- this._addAnnotatedComputationEffect(note, index);
3692
- } else {
3693
- note.index = index;
3694
- this._addPropertyEffect(note.model, 'annotation', note);
3695
4363
  }
3696
4364
  },
3697
- _addAnnotatedComputationEffect: function (note, index) {
3698
- var sig = note.signature;
4365
+ _addAnnotatedComputationEffect: function (note, part, index) {
4366
+ var sig = part.signature;
3699
4367
  if (sig.static) {
3700
- this.__addAnnotatedComputationEffect('__static__', index, note, sig, null);
4368
+ this.__addAnnotatedComputationEffect('__static__', index, note, part, null);
3701
4369
  } else {
3702
- sig.args.forEach(function (arg) {
4370
+ for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
3703
4371
  if (!arg.literal) {
3704
- this.__addAnnotatedComputationEffect(arg.model, index, note, sig, arg);
4372
+ this.__addAnnotatedComputationEffect(arg.model, index, note, part, arg);
4373
+ }
3705
4374
  }
3706
- }, this);
3707
4375
  }
3708
4376
  },
3709
- __addAnnotatedComputationEffect: function (property, index, note, sig, trigger) {
4377
+ __addAnnotatedComputationEffect: function (property, index, note, part, trigger) {
3710
4378
  this._addPropertyEffect(property, 'annotatedComputation', {
3711
4379
  index: index,
4380
+ isCompound: note.isCompound,
4381
+ compoundIndex: part.compoundIndex,
3712
4382
  kind: note.kind,
3713
- property: note.name,
3714
- negate: note.negate,
3715
- method: sig.method,
3716
- args: sig.args,
4383
+ name: note.name,
4384
+ negate: part.negate,
4385
+ method: part.signature.method,
4386
+ args: part.signature.args,
3717
4387
  trigger: trigger
3718
4388
  });
3719
4389
  },
@@ -3780,11 +4450,18 @@ return a;
3780
4450
  },
3781
4451
  _marshalInstanceEffects: function () {
3782
4452
  Polymer.Bind.prepareInstance(this);
4453
+ if (this._bindListeners) {
3783
4454
  Polymer.Bind.setupBindListeners(this);
4455
+ }
3784
4456
  },
3785
- _applyEffectValue: function (value, info) {
4457
+ _applyEffectValue: function (info, value) {
3786
4458
  var node = this._nodes[info.index];
3787
- var property = info.property || info.name || 'textContent';
4459
+ var property = info.name;
4460
+ if (info.isCompound) {
4461
+ var storage = node.__compoundStorage__[property];
4462
+ storage[info.compoundIndex] = value;
4463
+ value = storage.join('');
4464
+ }
3788
4465
  if (info.kind == 'attribute') {
3789
4466
  this.serializeValueToAttribute(value, property, node);
3790
4467
  } else {
@@ -3794,11 +4471,14 @@ value = this._scopeElementClass(node, value);
3794
4471
  if (property === 'textContent' || node.localName == 'input' && property == 'value') {
3795
4472
  value = value == undefined ? '' : value;
3796
4473
  }
3797
- return node[property] = value;
4474
+ var pinfo;
4475
+ if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) || !pinfo.readOnly) {
4476
+ this.__setProperty(property, value, true, node);
4477
+ }
3798
4478
  }
3799
4479
  },
3800
4480
  _executeStaticEffects: function () {
3801
- if (this._propertyEffects.__static__) {
4481
+ if (this._propertyEffects && this._propertyEffects.__static__) {
3802
4482
  this._effectEffects('__static__', null, this._propertyEffects.__static__);
3803
4483
  }
3804
4484
  }
@@ -3806,12 +4486,14 @@ this._effectEffects('__static__', null, this._propertyEffects.__static__);
3806
4486
  Polymer.Base._addFeature({
3807
4487
  _setupConfigure: function (initialConfig) {
3808
4488
  this._config = {};
4489
+ this._handlers = [];
4490
+ if (initialConfig) {
3809
4491
  for (var i in initialConfig) {
3810
4492
  if (initialConfig[i] !== undefined) {
3811
4493
  this._config[i] = initialConfig[i];
3812
4494
  }
3813
4495
  }
3814
- this._handlers = [];
4496
+ }
3815
4497
  },
3816
4498
  _marshalAttributes: function () {
3817
4499
  this._takeAttributesToModel(this._config);
@@ -3821,7 +4503,10 @@ var model = this._clientsReadied ? this : this._config;
3821
4503
  this._setAttributeToProperty(model, name);
3822
4504
  },
3823
4505
  _configValue: function (name, value) {
4506
+ var info = this._propertyInfo[name];
4507
+ if (!info || !info.readOnly) {
3824
4508
  this._config[name] = value;
4509
+ }
3825
4510
  },
3826
4511
  _beforeClientsReady: function () {
3827
4512
  this._configure();
@@ -3830,13 +4515,15 @@ _configure: function () {
3830
4515
  this._configureAnnotationReferences();
3831
4516
  this._aboveConfig = this.mixin({}, this._config);
3832
4517
  var config = {};
3833
- this.behaviors.forEach(function (b) {
3834
- this._configureProperties(b.properties, config);
3835
- }, this);
4518
+ for (var i = 0; i < this.behaviors.length; i++) {
4519
+ this._configureProperties(this.behaviors[i].properties, config);
4520
+ }
3836
4521
  this._configureProperties(this.properties, config);
3837
- this._mixinConfigure(config, this._aboveConfig);
4522
+ this.mixin(config, this._aboveConfig);
3838
4523
  this._config = config;
4524
+ if (this._clients && this._clients.length) {
3839
4525
  this._distributeConfig(this._config);
4526
+ }
3840
4527
  },
3841
4528
  _configureProperties: function (properties, config) {
3842
4529
  for (var i in properties) {
@@ -3850,13 +4537,6 @@ config[i] = value;
3850
4537
  }
3851
4538
  }
3852
4539
  },
3853
- _mixinConfigure: function (a, b) {
3854
- for (var prop in b) {
3855
- if (!this.getPropertyInfo(prop).readOnly) {
3856
- a[prop] = b[prop];
3857
- }
3858
- }
3859
- },
3860
4540
  _distributeConfig: function (config) {
3861
4541
  var fx$ = this._propertyEffects;
3862
4542
  if (fx$) {
@@ -3864,10 +4544,10 @@ for (var p in config) {
3864
4544
  var fx = fx$[p];
3865
4545
  if (fx) {
3866
4546
  for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) {
3867
- if (x.kind === 'annotation') {
4547
+ if (x.kind === 'annotation' && !x.isCompound) {
3868
4548
  var node = this._nodes[x.effect.index];
3869
4549
  if (node._configValue) {
3870
- var value = p === x.effect.value ? config[p] : this.get(x.effect.value, config);
4550
+ var value = p === x.effect.value ? config[p] : this._get(x.effect.value, config);
3871
4551
  node._configValue(x.effect.name, value);
3872
4552
  }
3873
4553
  }
@@ -3889,14 +4569,22 @@ this.__setProperty(n, config[n], n in aboveConfig);
3889
4569
  }
3890
4570
  },
3891
4571
  _notifyListener: function (fn, e) {
4572
+ if (!Polymer.Bind._isEventBogus(e, e.target)) {
4573
+ var value, path;
4574
+ if (e.detail) {
4575
+ value = e.detail.value;
4576
+ path = e.detail.path;
4577
+ }
3892
4578
  if (!this._clientsReadied) {
3893
4579
  this._queueHandler([
3894
4580
  fn,
3895
- e,
3896
- e.target
4581
+ e.target,
4582
+ value,
4583
+ path
3897
4584
  ]);
3898
4585
  } else {
3899
- return fn.call(this, e, e.target);
4586
+ return fn.call(this, e.target, value, path);
4587
+ }
3900
4588
  }
3901
4589
  },
3902
4590
  _queueHandler: function (args) {
@@ -3905,7 +4593,7 @@ this._handlers.push(args);
3905
4593
  _flushHandlers: function () {
3906
4594
  var h$ = this._handlers;
3907
4595
  for (var i = 0, l = h$.length, h; i < l && (h = h$[i]); i++) {
3908
- h[0].call(this, h[1], h[2]);
4596
+ h[0].call(this, h[1], h[2], h[3]);
3909
4597
  }
3910
4598
  this._handlers = [];
3911
4599
  }
@@ -3914,11 +4602,16 @@ this._handlers = [];
3914
4602
  'use strict';
3915
4603
  Polymer.Base._addFeature({
3916
4604
  notifyPath: function (path, value, fromAbove) {
4605
+ var info = {};
4606
+ this._get(path, this, info);
4607
+ this._notifyPath(info.path, value, fromAbove);
4608
+ },
4609
+ _notifyPath: function (path, value, fromAbove) {
3917
4610
  var old = this._propertySetter(path, value);
3918
4611
  if (old !== value && (old === old || value === value)) {
3919
4612
  this._pathEffector(path, value);
3920
4613
  if (!fromAbove) {
3921
- this._notifyPath(path, value);
4614
+ this._notifyPathUp(path, value);
3922
4615
  }
3923
4616
  return true;
3924
4617
  }
@@ -3945,52 +4638,78 @@ var last = parts[parts.length - 1];
3945
4638
  if (parts.length > 1) {
3946
4639
  for (var i = 0; i < parts.length - 1; i++) {
3947
4640
  var part = parts[i];
4641
+ if (array && part[0] == '#') {
4642
+ prop = Polymer.Collection.get(array).getItem(part);
4643
+ } else {
3948
4644
  prop = prop[part];
3949
- if (array && parseInt(part) == part) {
4645
+ if (array && parseInt(part, 10) == part) {
3950
4646
  parts[i] = Polymer.Collection.get(array).getKey(prop);
3951
4647
  }
4648
+ }
3952
4649
  if (!prop) {
3953
4650
  return;
3954
4651
  }
3955
4652
  array = Array.isArray(prop) ? prop : null;
3956
4653
  }
3957
- if (array && parseInt(last) == last) {
4654
+ if (array) {
3958
4655
  var coll = Polymer.Collection.get(array);
4656
+ if (last[0] == '#') {
4657
+ var key = last;
4658
+ var old = coll.getItem(key);
4659
+ last = array.indexOf(old);
4660
+ coll.setItem(key, value);
4661
+ } else if (parseInt(last, 10) == last) {
3959
4662
  var old = prop[last];
3960
4663
  var key = coll.getKey(old);
3961
4664
  parts[i] = key;
3962
4665
  coll.setItem(key, value);
3963
4666
  }
4667
+ }
3964
4668
  prop[last] = value;
3965
4669
  if (!root) {
3966
- this.notifyPath(parts.join('.'), value);
4670
+ this._notifyPath(parts.join('.'), value);
3967
4671
  }
3968
4672
  } else {
3969
4673
  prop[path] = value;
3970
4674
  }
3971
4675
  },
3972
4676
  get: function (path, root) {
4677
+ return this._get(path, root);
4678
+ },
4679
+ _get: function (path, root, info) {
3973
4680
  var prop = root || this;
3974
4681
  var parts = this._getPathParts(path);
3975
- var last = parts.pop();
3976
- while (parts.length) {
3977
- prop = prop[parts.shift()];
4682
+ var array;
4683
+ for (var i = 0; i < parts.length; i++) {
3978
4684
  if (!prop) {
3979
4685
  return;
3980
4686
  }
4687
+ var part = parts[i];
4688
+ if (array && part[0] == '#') {
4689
+ prop = Polymer.Collection.get(array).getItem(part);
4690
+ } else {
4691
+ prop = prop[part];
4692
+ if (info && array && parseInt(part, 10) == part) {
4693
+ parts[i] = Polymer.Collection.get(array).getKey(prop);
4694
+ }
4695
+ }
4696
+ array = Array.isArray(prop) ? prop : null;
4697
+ }
4698
+ if (info) {
4699
+ info.path = parts.join('.');
3981
4700
  }
3982
- return prop[last];
4701
+ return prop;
3983
4702
  },
3984
4703
  _pathEffector: function (path, value) {
3985
4704
  var model = this._modelForPath(path);
3986
- var fx$ = this._propertyEffects[model];
4705
+ var fx$ = this._propertyEffects && this._propertyEffects[model];
3987
4706
  if (fx$) {
3988
- fx$.forEach(function (fx) {
3989
- var fxFn = this['_' + fx.kind + 'PathEffect'];
4707
+ for (var i = 0, fx; i < fx$.length && (fx = fx$[i]); i++) {
4708
+ var fxFn = fx.pathFn;
3990
4709
  if (fxFn) {
3991
4710
  fxFn.call(this, path, value, fx.effect);
3992
4711
  }
3993
- }, this);
4712
+ }
3994
4713
  }
3995
4714
  if (this._boundPaths) {
3996
4715
  this._notifyBoundPaths(path, value);
@@ -4001,9 +4720,9 @@ if (effect.value === path || effect.value.indexOf(path + '.') === 0) {
4001
4720
  Polymer.Bind._annotationEffect.call(this, path, value, effect);
4002
4721
  } else if (path.indexOf(effect.value + '.') === 0 && !effect.negate) {
4003
4722
  var node = this._nodes[effect.index];
4004
- if (node && node.notifyPath) {
4723
+ if (node && node._notifyPath) {
4005
4724
  var p = this._fixPath(effect.name, effect.value, path);
4006
- node.notifyPath(p, value, true);
4725
+ node._notifyPath(p, value, true);
4007
4726
  }
4008
4727
  }
4009
4728
  },
@@ -4043,70 +4762,88 @@ _notifyBoundPaths: function (path, value) {
4043
4762
  for (var a in this._boundPaths) {
4044
4763
  var b = this._boundPaths[a];
4045
4764
  if (path.indexOf(a + '.') == 0) {
4046
- this.notifyPath(this._fixPath(b, a, path), value);
4765
+ this._notifyPath(this._fixPath(b, a, path), value);
4047
4766
  } else if (path.indexOf(b + '.') == 0) {
4048
- this.notifyPath(this._fixPath(a, b, path), value);
4767
+ this._notifyPath(this._fixPath(a, b, path), value);
4049
4768
  }
4050
4769
  }
4051
4770
  },
4052
4771
  _fixPath: function (property, root, path) {
4053
4772
  return property + path.slice(root.length);
4054
4773
  },
4055
- _notifyPath: function (path, value) {
4774
+ _notifyPathUp: function (path, value) {
4056
4775
  var rootName = this._modelForPath(path);
4057
4776
  var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName);
4058
4777
  var eventName = dashCaseName + this._EVENT_CHANGED;
4059
4778
  this.fire(eventName, {
4060
4779
  path: path,
4061
4780
  value: value
4062
- }, { bubbles: false });
4781
+ }, {
4782
+ bubbles: false,
4783
+ _useCache: true
4784
+ });
4063
4785
  },
4064
4786
  _modelForPath: function (path) {
4065
4787
  var dot = path.indexOf('.');
4066
4788
  return dot < 0 ? path : path.slice(0, dot);
4067
4789
  },
4068
4790
  _EVENT_CHANGED: '-changed',
4069
- _notifySplice: function (array, path, index, added, removed) {
4070
- var splices = [{
4071
- index: index,
4072
- addedCount: added,
4073
- removed: removed,
4074
- object: array,
4075
- type: 'splice'
4076
- }];
4791
+ notifySplices: function (path, splices) {
4792
+ var info = {};
4793
+ var array = this._get(path, this, info);
4794
+ this._notifySplices(array, info.path, splices);
4795
+ },
4796
+ _notifySplices: function (array, path, splices) {
4077
4797
  var change = {
4078
4798
  keySplices: Polymer.Collection.applySplices(array, splices),
4079
4799
  indexSplices: splices
4080
4800
  };
4081
- this.set(path + '.splices', change);
4082
- if (added != removed.length) {
4083
- this.notifyPath(path + '.length', array.length);
4801
+ if (!array.hasOwnProperty('splices')) {
4802
+ Object.defineProperty(array, 'splices', {
4803
+ configurable: true,
4804
+ writable: true
4805
+ });
4084
4806
  }
4807
+ array.splices = change;
4808
+ this._notifyPath(path + '.splices', change);
4809
+ this._notifyPath(path + '.length', array.length);
4085
4810
  change.keySplices = null;
4086
4811
  change.indexSplices = null;
4087
4812
  },
4813
+ _notifySplice: function (array, path, index, added, removed) {
4814
+ this._notifySplices(array, path, [{
4815
+ index: index,
4816
+ addedCount: added,
4817
+ removed: removed,
4818
+ object: array,
4819
+ type: 'splice'
4820
+ }]);
4821
+ },
4088
4822
  push: function (path) {
4089
- var array = this.get(path);
4823
+ var info = {};
4824
+ var array = this._get(path, this, info);
4090
4825
  var args = Array.prototype.slice.call(arguments, 1);
4091
4826
  var len = array.length;
4092
4827
  var ret = array.push.apply(array, args);
4093
4828
  if (args.length) {
4094
- this._notifySplice(array, path, len, args.length, []);
4829
+ this._notifySplice(array, info.path, len, args.length, []);
4095
4830
  }
4096
4831
  return ret;
4097
4832
  },
4098
4833
  pop: function (path) {
4099
- var array = this.get(path);
4834
+ var info = {};
4835
+ var array = this._get(path, this, info);
4100
4836
  var hadLength = Boolean(array.length);
4101
4837
  var args = Array.prototype.slice.call(arguments, 1);
4102
4838
  var ret = array.pop.apply(array, args);
4103
4839
  if (hadLength) {
4104
- this._notifySplice(array, path, array.length, 0, [ret]);
4840
+ this._notifySplice(array, info.path, array.length, 0, [ret]);
4105
4841
  }
4106
4842
  return ret;
4107
4843
  },
4108
4844
  splice: function (path, start, deleteCount) {
4109
- var array = this.get(path);
4845
+ var info = {};
4846
+ var array = this._get(path, this, info);
4110
4847
  if (start < 0) {
4111
4848
  start = array.length - Math.floor(-start);
4112
4849
  } else {
@@ -4119,28 +4856,51 @@ var args = Array.prototype.slice.call(arguments, 1);
4119
4856
  var ret = array.splice.apply(array, args);
4120
4857
  var addedCount = Math.max(args.length - 2, 0);
4121
4858
  if (addedCount || ret.length) {
4122
- this._notifySplice(array, path, start, addedCount, ret);
4859
+ this._notifySplice(array, info.path, start, addedCount, ret);
4123
4860
  }
4124
4861
  return ret;
4125
4862
  },
4126
4863
  shift: function (path) {
4127
- var array = this.get(path);
4864
+ var info = {};
4865
+ var array = this._get(path, this, info);
4128
4866
  var hadLength = Boolean(array.length);
4129
4867
  var args = Array.prototype.slice.call(arguments, 1);
4130
4868
  var ret = array.shift.apply(array, args);
4131
4869
  if (hadLength) {
4132
- this._notifySplice(array, path, 0, 0, [ret]);
4870
+ this._notifySplice(array, info.path, 0, 0, [ret]);
4133
4871
  }
4134
4872
  return ret;
4135
4873
  },
4136
4874
  unshift: function (path) {
4137
- var array = this.get(path);
4875
+ var info = {};
4876
+ var array = this._get(path, this, info);
4138
4877
  var args = Array.prototype.slice.call(arguments, 1);
4139
4878
  var ret = array.unshift.apply(array, args);
4140
4879
  if (args.length) {
4141
- this._notifySplice(array, path, 0, args.length, []);
4880
+ this._notifySplice(array, info.path, 0, args.length, []);
4142
4881
  }
4143
4882
  return ret;
4883
+ },
4884
+ prepareModelNotifyPath: function (model) {
4885
+ this.mixin(model, {
4886
+ fire: Polymer.Base.fire,
4887
+ _getEvent: Polymer.Base._getEvent,
4888
+ __eventCache: Polymer.Base.__eventCache,
4889
+ notifyPath: Polymer.Base.notifyPath,
4890
+ _get: Polymer.Base._get,
4891
+ _EVENT_CHANGED: Polymer.Base._EVENT_CHANGED,
4892
+ _notifyPath: Polymer.Base._notifyPath,
4893
+ _notifyPathUp: Polymer.Base._notifyPathUp,
4894
+ _pathEffector: Polymer.Base._pathEffector,
4895
+ _annotationPathEffect: Polymer.Base._annotationPathEffect,
4896
+ _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect,
4897
+ _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect,
4898
+ _computePathEffect: Polymer.Base._computePathEffect,
4899
+ _modelForPath: Polymer.Base._modelForPath,
4900
+ _pathMatchesEffect: Polymer.Base._pathMatchesEffect,
4901
+ _notifyBoundPaths: Polymer.Base._notifyBoundPaths,
4902
+ _getPathParts: Polymer.Base._getPathParts
4903
+ });
4144
4904
  }
4145
4905
  });
4146
4906
  }());
@@ -4199,6 +4959,8 @@ node.parsedCssText = node.cssText = t.trim();
4199
4959
  if (node.parent) {
4200
4960
  var ss = node.previous ? node.previous.end : node.parent.start;
4201
4961
  t = text.substring(ss, node.start - 1);
4962
+ t = this._expandUnicodeEscapes(t);
4963
+ t = t.replace(this._rx.multipleSpaces, ' ');
4202
4964
  t = t.substring(t.lastIndexOf(';') + 1);
4203
4965
  var s = node.parsedSelector = node.selector = t.trim();
4204
4966
  node.atRule = s.indexOf(this.AT_START) === 0;
@@ -4224,6 +4986,15 @@ this._parseCss(r, text);
4224
4986
  }
4225
4987
  return node;
4226
4988
  },
4989
+ _expandUnicodeEscapes: function (s) {
4990
+ return s.replace(/\\([0-9a-f]{1,6})\s/gi, function () {
4991
+ var code = arguments[1], repeat = 6 - code.length;
4992
+ while (repeat--) {
4993
+ code = '0' + code;
4994
+ }
4995
+ return '\\' + code;
4996
+ });
4997
+ },
4227
4998
  stringify: function (node, preserveProperties, text) {
4228
4999
  text = text || '';
4229
5000
  var cssText = '';
@@ -4253,7 +5024,7 @@ text += this.CLOSE_BRACE + '\n\n';
4253
5024
  return text;
4254
5025
  },
4255
5026
  _hasMixinRules: function (rules) {
4256
- return rules[0].selector.indexOf(this.VAR_START) >= 0;
5027
+ return rules[0].selector.indexOf(this.VAR_START) === 0;
4257
5028
  },
4258
5029
  removeCustomProps: function (cssText) {
4259
5030
  cssText = this.removeCustomPropAssignment(cssText);
@@ -4277,10 +5048,11 @@ _rx: {
4277
5048
  comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
4278
5049
  port: /@import[^;]*;/gim,
4279
5050
  customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim,
4280
- mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
5051
+ mixinProp: /(?:^|[\s;])?--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
4281
5052
  mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim,
4282
- varApply: /[^;:]*?:[^;]*var[^;]*(?:[;\n]|$)?/gim,
4283
- keyframesRule: /^@[^\s]*keyframes/
5053
+ varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,
5054
+ keyframesRule: /^@[^\s]*keyframes/,
5055
+ multipleSpaces: /\s+/g
4284
5056
  },
4285
5057
  VAR_START: '--',
4286
5058
  MEDIA_START: '@media',
@@ -4360,21 +5132,21 @@ return cssText;
4360
5132
  cssFromModule: function (moduleId, warnIfNotFound) {
4361
5133
  var m = Polymer.DomModule.import(moduleId);
4362
5134
  if (m && !m._cssText) {
4363
- m._cssText = this._cssFromElement(m);
5135
+ m._cssText = this.cssFromElement(m);
4364
5136
  }
4365
5137
  if (!m && warnIfNotFound) {
4366
5138
  console.warn('Could not find style data in module named', moduleId);
4367
5139
  }
4368
5140
  return m && m._cssText || '';
4369
5141
  },
4370
- _cssFromElement: function (element) {
5142
+ cssFromElement: function (element) {
4371
5143
  var cssText = '';
4372
5144
  var content = element.content || element;
4373
- var e$ = Array.prototype.slice.call(content.querySelectorAll(this.MODULE_STYLES_SELECTOR));
5145
+ var e$ = Polymer.DomApi.arrayCopy(content.querySelectorAll(this.MODULE_STYLES_SELECTOR));
4374
5146
  for (var i = 0, e; i < e$.length; i++) {
4375
5147
  e = e$[i];
4376
5148
  if (e.localName === 'template') {
4377
- cssText += this._cssFromElement(e);
5149
+ cssText += this.cssFromElement(e);
4378
5150
  } else {
4379
5151
  if (e.localName === 'style') {
4380
5152
  var include = e.getAttribute(this.INCLUDE_ATTR);
@@ -4623,7 +5395,7 @@ _extendRule: function (target, source) {
4623
5395
  if (target.parent !== source.parent) {
4624
5396
  this._cloneAndAddRuleToParent(source, target.parent);
4625
5397
  }
4626
- target.extends = target.extends || (target.extends = []);
5398
+ target.extends = target.extends || [];
4627
5399
  target.extends.push(source);
4628
5400
  source.selector = source.selector.replace(this.rx.STRIP, '');
4629
5401
  source.selector = (source.selector && source.selector + ',\n') + target.selector;
@@ -4664,14 +5436,18 @@ _prepStyles: function () {
4664
5436
  if (this._encapsulateStyle === undefined) {
4665
5437
  this._encapsulateStyle = !nativeShadow && Boolean(this._template);
4666
5438
  }
5439
+ if (this._template) {
4667
5440
  this._styles = this._collectStyles();
4668
5441
  var cssText = styleTransformer.elementStyles(this);
4669
- if (cssText && this._template) {
5442
+ if (cssText) {
4670
5443
  var style = styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : null);
4671
5444
  if (!nativeShadow) {
4672
5445
  this._scopeStyle = style;
4673
5446
  }
4674
5447
  }
5448
+ } else {
5449
+ this._styles = [];
5450
+ }
4675
5451
  },
4676
5452
  _collectStyles: function () {
4677
5453
  var styles = [];
@@ -4682,6 +5458,10 @@ cssText += styleUtil.cssFromModule(m);
4682
5458
  }
4683
5459
  }
4684
5460
  cssText += styleUtil.cssFromModule(this.is);
5461
+ var p = this._template && this._template.parentNode;
5462
+ if (this._template && (!p || p.id.toLowerCase() !== this.is)) {
5463
+ cssText += styleUtil.cssFromElement(this._template);
5464
+ }
4685
5465
  if (cssText) {
4686
5466
  var style = document.createElement('style');
4687
5467
  style.textContent = cssText;
@@ -4715,21 +5495,21 @@ var scopify = function (node) {
4715
5495
  if (node.nodeType === Node.ELEMENT_NODE) {
4716
5496
  node.className = self._scopeElementClass(node, node.className);
4717
5497
  var n$ = node.querySelectorAll('*');
4718
- Array.prototype.forEach.call(n$, function (n) {
5498
+ for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
4719
5499
  n.className = self._scopeElementClass(n, n.className);
4720
- });
5500
+ }
4721
5501
  }
4722
5502
  };
4723
5503
  scopify(container);
4724
5504
  if (shouldObserve) {
4725
5505
  var mo = new MutationObserver(function (mxns) {
4726
- mxns.forEach(function (m) {
5506
+ for (var i = 0, m; i < mxns.length && (m = mxns[i]); i++) {
4727
5507
  if (m.addedNodes) {
4728
- for (var i = 0; i < m.addedNodes.length; i++) {
4729
- scopify(m.addedNodes[i]);
5508
+ for (var j = 0; j < m.addedNodes.length; j++) {
5509
+ scopify(m.addedNodes[j]);
5510
+ }
4730
5511
  }
4731
5512
  }
4732
- });
4733
5513
  });
4734
5514
  mo.observe(container, {
4735
5515
  childList: true,
@@ -4854,7 +5634,9 @@ p = pp.join(':');
4854
5634
  parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || '';
4855
5635
  }
4856
5636
  }
4857
- return parts.join(';');
5637
+ return parts.filter(function (v) {
5638
+ return v;
5639
+ }).join(';');
4858
5640
  },
4859
5641
  applyProperties: function (rule, props) {
4860
5642
  var output = '';
@@ -4980,7 +5762,7 @@ props[i] = v;
4980
5762
  }
4981
5763
  },
4982
5764
  rx: {
4983
- VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
5765
+ VAR_ASSIGN: /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,
4984
5766
  MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
4985
5767
  VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
4986
5768
  VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
@@ -5099,9 +5881,12 @@ var styleDefaults = Polymer.StyleDefaults;
5099
5881
  var nativeShadow = Polymer.Settings.useNativeShadow;
5100
5882
  Polymer.Base._addFeature({
5101
5883
  _prepStyleProperties: function () {
5102
- this._ownStylePropertyNames = this._styles ? propertyUtils.decorateStyles(this._styles) : [];
5884
+ this._ownStylePropertyNames = this._styles ? propertyUtils.decorateStyles(this._styles) : null;
5885
+ },
5886
+ customStyle: null,
5887
+ getComputedStyleValue: function (property) {
5888
+ return this._styleProperties && this._styleProperties[property] || getComputedStyle(this).getPropertyValue(property);
5103
5889
  },
5104
- customStyle: {},
5105
5890
  _setupStyleProperties: function () {
5106
5891
  this.customStyle = {};
5107
5892
  },
@@ -5198,7 +5983,7 @@ if (host) {
5198
5983
  value = host._scopeElementClass(node, value);
5199
5984
  }
5200
5985
  }
5201
- node = Polymer.dom(node);
5986
+ node = this.shadyRoot && this.shadyRoot._hasDistributed ? Polymer.dom(node) : node;
5202
5987
  serializeValueToAttribute.call(this, value, attribute, node);
5203
5988
  },
5204
5989
  _scopeElementClass: function (element, selector) {
@@ -5247,7 +6032,6 @@ var XSCOPE_NAME = propertyUtils.XSCOPE_NAME;
5247
6032
  Polymer.Base._addFeature({
5248
6033
  _registerFeatures: function () {
5249
6034
  this._prepIs();
5250
- this._prepAttributes();
5251
6035
  this._prepConstructor();
5252
6036
  this._prepTemplate();
5253
6037
  this._prepStyles();
@@ -5255,6 +6039,7 @@ this._prepStyleProperties();
5255
6039
  this._prepAnnotations();
5256
6040
  this._prepEffects();
5257
6041
  this._prepBehaviors();
6042
+ this._prepPropertyInfo();
5258
6043
  this._prepBindings();
5259
6044
  this._prepShady();
5260
6045
  },
@@ -5264,23 +6049,28 @@ this._addComplexObserverEffects(b.observers);
5264
6049
  this._addHostAttributes(b.hostAttributes);
5265
6050
  },
5266
6051
  _initFeatures: function () {
5267
- this._poolContent();
5268
6052
  this._setupConfigure();
5269
6053
  this._setupStyleProperties();
5270
- this._pushHost();
6054
+ this._setupDebouncers();
6055
+ this._registerHost();
6056
+ if (this._template) {
6057
+ this._poolContent();
6058
+ this._beginHosting();
5271
6059
  this._stampTemplate();
5272
- this._popHost();
6060
+ this._endHosting();
5273
6061
  this._marshalAnnotationReferences();
5274
- this._setupDebouncers();
6062
+ }
5275
6063
  this._marshalInstanceEffects();
5276
- this._marshalHostAttributes();
5277
6064
  this._marshalBehaviors();
6065
+ this._marshalHostAttributes();
5278
6066
  this._marshalAttributes();
5279
6067
  this._tryReady();
5280
6068
  },
5281
6069
  _marshalBehavior: function (b) {
6070
+ if (b.listeners) {
5282
6071
  this._listenListeners(b.listeners);
5283
6072
  }
6073
+ }
5284
6074
  });
5285
6075
  (function () {
5286
6076
  var nativeShadow = Polymer.Settings.useNativeShadow;
@@ -5292,6 +6082,7 @@ var styleTransformer = Polymer.StyleTransformer;
5292
6082
  Polymer({
5293
6083
  is: 'custom-style',
5294
6084
  extends: 'style',
6085
+ _template: null,
5295
6086
  properties: { include: String },
5296
6087
  ready: function () {
5297
6088
  this._tryApply();
@@ -5306,18 +6097,19 @@ this._appliesToDocument = true;
5306
6097
  var e = this.__appliedElement || this;
5307
6098
  styleDefaults.addStyle(e);
5308
6099
  if (e.textContent || this.include) {
5309
- this._apply();
6100
+ this._apply(true);
5310
6101
  } else {
6102
+ var self = this;
5311
6103
  var observer = new MutationObserver(function () {
5312
6104
  observer.disconnect();
5313
- this._apply();
5314
- }.bind(this));
6105
+ self._apply(true);
6106
+ });
5315
6107
  observer.observe(e, { childList: true });
5316
6108
  }
5317
6109
  }
5318
6110
  }
5319
6111
  },
5320
- _apply: function () {
6112
+ _apply: function (deferProperties) {
5321
6113
  var e = this.__appliedElement || this;
5322
6114
  if (this.include) {
5323
6115
  e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent;
@@ -5326,7 +6118,19 @@ if (e.textContent) {
5326
6118
  styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
5327
6119
  styleTransformer.documentRule(rule);
5328
6120
  });
5329
- this._applyCustomProperties(e);
6121
+ var self = this;
6122
+ function fn() {
6123
+ self._applyCustomProperties(e);
6124
+ }
6125
+ if (this._pendingApplyProperties) {
6126
+ cancelAnimationFrame(this._pendingApplyProperties);
6127
+ this._pendingApplyProperties = null;
6128
+ }
6129
+ if (deferProperties) {
6130
+ this._pendingApplyProperties = requestAnimationFrame(fn);
6131
+ } else {
6132
+ fn();
6133
+ }
5330
6134
  }
5331
6135
  },
5332
6136
  _applyCustomProperties: function (element) {
@@ -5348,6 +6152,7 @@ properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
5348
6152
  _instanceProps: Polymer.nob,
5349
6153
  _parentPropPrefix: '_parent_',
5350
6154
  templatize: function (template) {
6155
+ this._templatized = template;
5351
6156
  if (!template._content) {
5352
6157
  template._content = template.content;
5353
6158
  }
@@ -5358,12 +6163,13 @@ return;
5358
6163
  }
5359
6164
  var archetype = Object.create(Polymer.Base);
5360
6165
  this._customPrepAnnotations(archetype, template);
6166
+ this._prepParentProperties(archetype, template);
5361
6167
  archetype._prepEffects();
5362
6168
  this._customPrepEffects(archetype);
5363
6169
  archetype._prepBehaviors();
6170
+ archetype._prepPropertyInfo();
5364
6171
  archetype._prepBindings();
5365
- this._prepParentProperties(archetype, template);
5366
- archetype._notifyPath = this._notifyPathImpl;
6172
+ archetype._notifyPathUp = this._notifyPathUpImpl;
5367
6173
  archetype._scopeElementClass = this._scopeElementClassImpl;
5368
6174
  archetype.listen = this._listenImpl;
5369
6175
  archetype._showHideChildren = this._showHideChildrenImpl;
@@ -5424,7 +6230,9 @@ var c = template._content;
5424
6230
  if (!c._notes) {
5425
6231
  var rootDataHost = archetype._rootDataHost;
5426
6232
  if (rootDataHost) {
5427
- Polymer.Annotations.prepElement = rootDataHost._prepElement.bind(rootDataHost);
6233
+ Polymer.Annotations.prepElement = function () {
6234
+ rootDataHost._prepElement();
6235
+ };
5428
6236
  }
5429
6237
  c._notes = Polymer.Annotations.parseAnnotations(template);
5430
6238
  Polymer.Annotations.prepElement = null;
@@ -5445,24 +6253,36 @@ delete parentProps[prop];
5445
6253
  proto = archetype._parentPropProto = Object.create(null);
5446
6254
  if (template != this) {
5447
6255
  Polymer.Bind.prepareModel(proto);
6256
+ Polymer.Base.prepareModelNotifyPath(proto);
5448
6257
  }
5449
6258
  for (prop in parentProps) {
5450
6259
  var parentProp = this._parentPropPrefix + prop;
5451
6260
  var effects = [
5452
6261
  {
5453
6262
  kind: 'function',
5454
- effect: this._createForwardPropEffector(prop)
6263
+ effect: this._createForwardPropEffector(prop),
6264
+ fn: Polymer.Bind._functionEffect
5455
6265
  },
5456
- { kind: 'notify' }
6266
+ {
6267
+ kind: 'notify',
6268
+ fn: Polymer.Bind._notifyEffect,
6269
+ effect: { event: Polymer.CaseMap.camelToDashCase(parentProp) + '-changed' }
6270
+ }
5457
6271
  ];
5458
6272
  Polymer.Bind._createAccessors(proto, parentProp, effects);
5459
6273
  }
5460
6274
  }
6275
+ var self = this;
5461
6276
  if (template != this) {
5462
6277
  Polymer.Bind.prepareInstance(template);
5463
- template._forwardParentProp = this._forwardParentProp.bind(this);
6278
+ template._forwardParentProp = function (source, value) {
6279
+ self._forwardParentProp(source, value);
6280
+ };
5464
6281
  }
5465
6282
  this._extendTemplate(template, proto);
6283
+ template._pathEffector = function (path, value, fromAbove) {
6284
+ return self._pathEffectorImpl(path, value, fromAbove);
6285
+ };
5466
6286
  }
5467
6287
  },
5468
6288
  _createForwardPropEffector: function (prop) {
@@ -5473,7 +6293,7 @@ this._forwardParentProp(prop, value);
5473
6293
  _createHostPropEffector: function (prop) {
5474
6294
  var prefix = this._parentPropPrefix;
5475
6295
  return function (source, value) {
5476
- this.dataHost[prefix + prop] = value;
6296
+ this.dataHost._templatized[prefix + prop] = value;
5477
6297
  };
5478
6298
  },
5479
6299
  _createInstancePropEffector: function (prop) {
@@ -5484,14 +6304,15 @@ this.dataHost._forwardInstanceProp(this, prop, value);
5484
6304
  };
5485
6305
  },
5486
6306
  _extendTemplate: function (template, proto) {
5487
- Object.getOwnPropertyNames(proto).forEach(function (n) {
6307
+ var n$ = Object.getOwnPropertyNames(proto);
6308
+ for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
5488
6309
  var val = template[n];
5489
6310
  var pd = Object.getOwnPropertyDescriptor(proto, n);
5490
6311
  Object.defineProperty(template, n, pd);
5491
6312
  if (val !== undefined) {
5492
6313
  template._propertySetter(n, val);
5493
6314
  }
5494
- });
6315
+ }
5495
6316
  },
5496
6317
  _showHideChildren: function (hidden) {
5497
6318
  },
@@ -5499,31 +6320,36 @@ _forwardInstancePath: function (inst, path, value) {
5499
6320
  },
5500
6321
  _forwardInstanceProp: function (inst, prop, value) {
5501
6322
  },
5502
- _notifyPathImpl: function (path, value) {
6323
+ _notifyPathUpImpl: function (path, value) {
5503
6324
  var dataHost = this.dataHost;
5504
6325
  var dot = path.indexOf('.');
5505
6326
  var root = dot < 0 ? path : path.slice(0, dot);
5506
6327
  dataHost._forwardInstancePath.call(dataHost, this, path, value);
5507
6328
  if (root in dataHost._parentProps) {
5508
- dataHost.notifyPath(dataHost._parentPropPrefix + path, value);
6329
+ dataHost._templatized.notifyPath(dataHost._parentPropPrefix + path, value);
5509
6330
  }
5510
6331
  },
5511
- _pathEffector: function (path, value, fromAbove) {
6332
+ _pathEffectorImpl: function (path, value, fromAbove) {
5512
6333
  if (this._forwardParentPath) {
5513
6334
  if (path.indexOf(this._parentPropPrefix) === 0) {
5514
- this._forwardParentPath(path.substring(8), value);
6335
+ var subPath = path.substring(this._parentPropPrefix.length);
6336
+ var model = this._modelForPath(subPath);
6337
+ if (model in this._parentProps) {
6338
+ this._forwardParentPath(subPath, value);
5515
6339
  }
5516
6340
  }
5517
- Polymer.Base._pathEffector.apply(this, arguments);
6341
+ }
6342
+ Polymer.Base._pathEffector.call(this._templatized, path, value, fromAbove);
5518
6343
  },
5519
6344
  _constructorImpl: function (model, host) {
5520
6345
  this._rootDataHost = host._getRootDataHost();
5521
6346
  this._setupConfigure(model);
5522
- this._pushHost(host);
6347
+ this._registerHost(host);
6348
+ this._beginHosting();
5523
6349
  this.root = this.instanceTemplate(this._template);
5524
6350
  this.root.__noContent = !this._notes._hasContent;
5525
6351
  this.root.__styleScoped = true;
5526
- this._popHost();
6352
+ this._endHosting();
5527
6353
  this._marshalAnnotatedNodes();
5528
6354
  this._marshalInstanceEffects();
5529
6355
  this._marshalAnnotatedListeners();
@@ -5557,8 +6383,9 @@ return host._scopeElementClass(node, value);
5557
6383
  stamp: function (model) {
5558
6384
  model = model || {};
5559
6385
  if (this._parentProps) {
6386
+ var templatized = this._templatized;
5560
6387
  for (var prop in this._parentProps) {
5561
- model[prop] = this[this._parentPropPrefix + prop];
6388
+ model[prop] = templatized[this._parentPropPrefix + prop];
5562
6389
  }
5563
6390
  }
5564
6391
  return new this.ctor(model, this);
@@ -5581,6 +6408,7 @@ el = el.parentNode;
5581
6408
  Polymer({
5582
6409
  is: 'dom-template',
5583
6410
  extends: 'template',
6411
+ _template: null,
5584
6412
  behaviors: [Polymer.Templatizer],
5585
6413
  ready: function () {
5586
6414
  this.templatize(this);
@@ -5615,9 +6443,10 @@ this.omap.set(item, key);
5615
6443
  } else {
5616
6444
  this.pmap[item] = key;
5617
6445
  }
5618
- return key;
6446
+ return '#' + key;
5619
6447
  },
5620
6448
  removeKey: function (key) {
6449
+ key = this._parseKey(key);
5621
6450
  this._removeFromMap(this.store[key]);
5622
6451
  delete this.store[key];
5623
6452
  },
@@ -5634,16 +6463,29 @@ this.removeKey(key);
5634
6463
  return key;
5635
6464
  },
5636
6465
  getKey: function (item) {
6466
+ var key;
5637
6467
  if (item && typeof item == 'object') {
5638
- return this.omap.get(item);
6468
+ key = this.omap.get(item);
5639
6469
  } else {
5640
- return this.pmap[item];
6470
+ key = this.pmap[item];
6471
+ }
6472
+ if (key != undefined) {
6473
+ return '#' + key;
5641
6474
  }
5642
6475
  },
5643
6476
  getKeys: function () {
5644
- return Object.keys(this.store);
6477
+ return Object.keys(this.store).map(function (key) {
6478
+ return '#' + key;
6479
+ });
6480
+ },
6481
+ _parseKey: function (key) {
6482
+ if (key[0] == '#') {
6483
+ return key.slice(1);
6484
+ }
6485
+ throw new Error('unexpected key ' + key);
5645
6486
  },
5646
6487
  setItem: function (key, item) {
6488
+ key = this._parseKey(key);
5647
6489
  var old = this.store[key];
5648
6490
  if (old) {
5649
6491
  this._removeFromMap(old);
@@ -5656,6 +6498,7 @@ this.pmap[item] = key;
5656
6498
  this.store[key] = item;
5657
6499
  },
5658
6500
  getItem: function (key) {
6501
+ key = this._parseKey(key);
5659
6502
  return this.store[key];
5660
6503
  },
5661
6504
  getItems: function () {
@@ -5666,21 +6509,21 @@ items.push(store[key]);
5666
6509
  return items;
5667
6510
  },
5668
6511
  _applySplices: function (splices) {
5669
- var keyMap = {}, key, i;
5670
- splices.forEach(function (s) {
6512
+ var keyMap = {}, key;
6513
+ for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
5671
6514
  s.addedKeys = [];
5672
- for (i = 0; i < s.removed.length; i++) {
5673
- key = this.getKey(s.removed[i]);
6515
+ for (var j = 0; j < s.removed.length; j++) {
6516
+ key = this.getKey(s.removed[j]);
5674
6517
  keyMap[key] = keyMap[key] ? null : -1;
5675
6518
  }
5676
- for (i = 0; i < s.addedCount; i++) {
5677
- var item = this.userArray[s.index + i];
6519
+ for (var j = 0; j < s.addedCount; j++) {
6520
+ var item = this.userArray[s.index + j];
5678
6521
  key = this.getKey(item);
5679
6522
  key = key === undefined ? this.add(item) : key;
5680
6523
  keyMap[key] = keyMap[key] ? null : 1;
5681
6524
  s.addedKeys.push(key);
5682
6525
  }
5683
- }, this);
6526
+ }
5684
6527
  var removed = [];
5685
6528
  var added = [];
5686
6529
  for (var key in keyMap) {
@@ -5708,6 +6551,7 @@ return coll ? coll._applySplices(splices) : null;
5708
6551
  Polymer({
5709
6552
  is: 'dom-repeat',
5710
6553
  extends: 'template',
6554
+ _template: null,
5711
6555
  properties: {
5712
6556
  items: { type: Array },
5713
6557
  as: {
@@ -5730,22 +6574,37 @@ observe: {
5730
6574
  type: String,
5731
6575
  observer: '_observeChanged'
5732
6576
  },
5733
- delay: Number
6577
+ delay: Number,
6578
+ initialCount: {
6579
+ type: Number,
6580
+ observer: '_initializeChunking'
6581
+ },
6582
+ targetFramerate: {
6583
+ type: Number,
6584
+ value: 20
6585
+ },
6586
+ _targetFrameTime: { computed: '_computeFrameTime(targetFramerate)' }
5734
6587
  },
5735
6588
  behaviors: [Polymer.Templatizer],
5736
6589
  observers: ['_itemsChanged(items.*)'],
5737
6590
  created: function () {
5738
6591
  this._instances = [];
6592
+ this._pool = [];
6593
+ this._limit = Infinity;
6594
+ var self = this;
6595
+ this._boundRenderChunk = function () {
6596
+ self._renderChunk();
6597
+ };
5739
6598
  },
5740
6599
  detached: function () {
5741
6600
  for (var i = 0; i < this._instances.length; i++) {
5742
- this._detachRow(i);
6601
+ this._detachInstance(i);
5743
6602
  }
5744
6603
  },
5745
6604
  attached: function () {
5746
- var parentNode = Polymer.dom(this).parentNode;
6605
+ var parent = Polymer.dom(Polymer.dom(this).parentNode);
5747
6606
  for (var i = 0; i < this._instances.length; i++) {
5748
- Polymer.dom(parentNode).insertBefore(this._instances[i].root, this);
6607
+ this._attachInstance(i, parent);
5749
6608
  }
5750
6609
  },
5751
6610
  ready: function () {
@@ -5756,9 +6615,8 @@ if (!this.ctor) {
5756
6615
  this.templatize(this);
5757
6616
  }
5758
6617
  },
5759
- _sortChanged: function () {
6618
+ _sortChanged: function (sort) {
5760
6619
  var dataHost = this._getRootDataHost();
5761
- var sort = this.sort;
5762
6620
  this._sortFn = sort && (typeof sort == 'function' ? sort : function () {
5763
6621
  return dataHost[sort].apply(dataHost, arguments);
5764
6622
  });
@@ -5767,9 +6625,8 @@ if (this.items) {
5767
6625
  this._debounceTemplate(this._render);
5768
6626
  }
5769
6627
  },
5770
- _filterChanged: function () {
6628
+ _filterChanged: function (filter) {
5771
6629
  var dataHost = this._getRootDataHost();
5772
- var filter = this.filter;
5773
6630
  this._filterFn = filter && (typeof filter == 'function' ? filter : function () {
5774
6631
  return dataHost[filter].apply(dataHost, arguments);
5775
6632
  });
@@ -5778,6 +6635,32 @@ if (this.items) {
5778
6635
  this._debounceTemplate(this._render);
5779
6636
  }
5780
6637
  },
6638
+ _computeFrameTime: function (rate) {
6639
+ return Math.ceil(1000 / rate);
6640
+ },
6641
+ _initializeChunking: function () {
6642
+ if (this.initialCount) {
6643
+ this._limit = this.initialCount;
6644
+ this._chunkCount = this.initialCount;
6645
+ this._lastChunkTime = performance.now();
6646
+ }
6647
+ },
6648
+ _tryRenderChunk: function () {
6649
+ if (this.items && this._limit < this.items.length) {
6650
+ this.debounce('renderChunk', this._requestRenderChunk);
6651
+ }
6652
+ },
6653
+ _requestRenderChunk: function () {
6654
+ requestAnimationFrame(this._boundRenderChunk);
6655
+ },
6656
+ _renderChunk: function () {
6657
+ var currChunkTime = performance.now();
6658
+ var ratio = this._targetFrameTime / (currChunkTime - this._lastChunkTime);
6659
+ this._chunkCount = Math.round(this._chunkCount * ratio) || 1;
6660
+ this._limit += this._chunkCount;
6661
+ this._lastChunkTime = currChunkTime;
6662
+ this._debounceTemplate(this._render);
6663
+ },
5781
6664
  _observeChanged: function () {
5782
6665
  this._observePaths = this.observe && this.observe.replace('.*', '.').split(' ');
5783
6666
  },
@@ -5793,6 +6676,7 @@ this._error(this._logf('dom-repeat', 'expected array for `items`,' + ' found', t
5793
6676
  this._keySplices = [];
5794
6677
  this._indexSplices = [];
5795
6678
  this._needFullRefresh = true;
6679
+ this._initializeChunking();
5796
6680
  this._debounceTemplate(this._render);
5797
6681
  } else if (change.path == 'items.splices') {
5798
6682
  this._keySplices = this._keySplices.concat(change.value.keySplices);
@@ -5831,7 +6715,7 @@ var c = this.collection;
5831
6715
  if (this._needFullRefresh) {
5832
6716
  this._applyFullRefresh();
5833
6717
  this._needFullRefresh = false;
5834
- } else {
6718
+ } else if (this._keySplices.length) {
5835
6719
  if (this._sortFn) {
5836
6720
  this._applySplicesUserSort(this._keySplices);
5837
6721
  } else {
@@ -5841,16 +6725,26 @@ this._applyFullRefresh();
5841
6725
  this._applySplicesArrayOrder(this._indexSplices);
5842
6726
  }
5843
6727
  }
6728
+ } else {
5844
6729
  }
5845
6730
  this._keySplices = [];
5846
6731
  this._indexSplices = [];
5847
6732
  var keyToIdx = this._keyToInstIdx = {};
5848
- for (var i = 0; i < this._instances.length; i++) {
6733
+ for (var i = this._instances.length - 1; i >= 0; i--) {
5849
6734
  var inst = this._instances[i];
6735
+ if (inst.isPlaceholder && i < this._limit) {
6736
+ inst = this._insertInstance(i, inst.__key__);
6737
+ } else if (!inst.isPlaceholder && i >= this._limit) {
6738
+ inst = this._downgradeInstance(i, inst.__key__);
6739
+ }
5850
6740
  keyToIdx[inst.__key__] = i;
6741
+ if (!inst.isPlaceholder) {
5851
6742
  inst.__setProperty(this.indexAs, i, true);
5852
6743
  }
6744
+ }
6745
+ this._pool.length = 0;
5853
6746
  this.fire('dom-change');
6747
+ this._tryRenderChunk();
5854
6748
  },
5855
6749
  _applyFullRefresh: function () {
5856
6750
  var c = this.collection;
@@ -5866,33 +6760,34 @@ keys.push(c.getKey(items[i]));
5866
6760
  }
5867
6761
  }
5868
6762
  }
6763
+ var self = this;
5869
6764
  if (this._filterFn) {
5870
6765
  keys = keys.filter(function (a) {
5871
- return this._filterFn(c.getItem(a));
5872
- }, this);
6766
+ return self._filterFn(c.getItem(a));
6767
+ });
5873
6768
  }
5874
6769
  if (this._sortFn) {
5875
6770
  keys.sort(function (a, b) {
5876
- return this._sortFn(c.getItem(a), c.getItem(b));
5877
- }.bind(this));
6771
+ return self._sortFn(c.getItem(a), c.getItem(b));
6772
+ });
5878
6773
  }
5879
6774
  for (var i = 0; i < keys.length; i++) {
5880
6775
  var key = keys[i];
5881
6776
  var inst = this._instances[i];
5882
6777
  if (inst) {
5883
- inst.__setProperty('__key__', key, true);
6778
+ inst.__key__ = key;
6779
+ if (!inst.isPlaceholder && i < this._limit) {
5884
6780
  inst.__setProperty(this.as, c.getItem(key), true);
6781
+ }
6782
+ } else if (i < this._limit) {
6783
+ this._insertInstance(i, key);
5885
6784
  } else {
5886
- this._instances.push(this._insertRow(i, key));
6785
+ this._insertPlaceholder(i, key);
5887
6786
  }
5888
6787
  }
5889
- for (; i < this._instances.length; i++) {
5890
- this._detachRow(i);
6788
+ for (var j = this._instances.length - 1; j >= i; j--) {
6789
+ this._detachAndRemoveInstance(j);
5891
6790
  }
5892
- this._instances.splice(keys.length, this._instances.length - keys.length);
5893
- },
5894
- _keySort: function (a, b) {
5895
- return this.collection.getKey(a) - this.collection.getKey(b);
5896
6791
  },
5897
6792
  _numericSort: function (a, b) {
5898
6793
  return a - b;
@@ -5901,18 +6796,16 @@ _applySplicesUserSort: function (splices) {
5901
6796
  var c = this.collection;
5902
6797
  var instances = this._instances;
5903
6798
  var keyMap = {};
5904
- var pool = [];
5905
- var sortFn = this._sortFn || this._keySort.bind(this);
5906
- splices.forEach(function (s) {
5907
- for (var i = 0; i < s.removed.length; i++) {
5908
- var key = s.removed[i];
6799
+ for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
6800
+ for (var j = 0; j < s.removed.length; j++) {
6801
+ var key = s.removed[j];
5909
6802
  keyMap[key] = keyMap[key] ? null : -1;
5910
6803
  }
5911
- for (var i = 0; i < s.added.length; i++) {
5912
- var key = s.added[i];
6804
+ for (var j = 0; j < s.added.length; j++) {
6805
+ var key = s.added[j];
5913
6806
  keyMap[key] = keyMap[key] ? null : 1;
5914
6807
  }
5915
- }, this);
6808
+ }
5916
6809
  var removedIdxs = [];
5917
6810
  var addedKeys = [];
5918
6811
  for (var key in keyMap) {
@@ -5928,36 +6821,35 @@ removedIdxs.sort(this._numericSort);
5928
6821
  for (var i = removedIdxs.length - 1; i >= 0; i--) {
5929
6822
  var idx = removedIdxs[i];
5930
6823
  if (idx !== undefined) {
5931
- pool.push(this._detachRow(idx));
5932
- instances.splice(idx, 1);
6824
+ this._detachAndRemoveInstance(idx);
5933
6825
  }
5934
6826
  }
5935
6827
  }
6828
+ var self = this;
5936
6829
  if (addedKeys.length) {
5937
6830
  if (this._filterFn) {
5938
6831
  addedKeys = addedKeys.filter(function (a) {
5939
- return this._filterFn(c.getItem(a));
5940
- }, this);
6832
+ return self._filterFn(c.getItem(a));
6833
+ });
5941
6834
  }
5942
6835
  addedKeys.sort(function (a, b) {
5943
- return this._sortFn(c.getItem(a), c.getItem(b));
5944
- }.bind(this));
6836
+ return self._sortFn(c.getItem(a), c.getItem(b));
6837
+ });
5945
6838
  var start = 0;
5946
6839
  for (var i = 0; i < addedKeys.length; i++) {
5947
- start = this._insertRowUserSort(start, addedKeys[i], pool);
6840
+ start = this._insertRowUserSort(start, addedKeys[i]);
5948
6841
  }
5949
6842
  }
5950
6843
  },
5951
- _insertRowUserSort: function (start, key, pool) {
6844
+ _insertRowUserSort: function (start, key) {
5952
6845
  var c = this.collection;
5953
6846
  var item = c.getItem(key);
5954
6847
  var end = this._instances.length - 1;
5955
6848
  var idx = -1;
5956
- var sortFn = this._sortFn || this._keySort.bind(this);
5957
6849
  while (start <= end) {
5958
6850
  var mid = start + end >> 1;
5959
6851
  var midKey = this._instances[mid].__key__;
5960
- var cmp = sortFn(c.getItem(midKey), item);
6852
+ var cmp = this._sortFn(c.getItem(midKey), item);
5961
6853
  if (cmp < 0) {
5962
6854
  start = mid + 1;
5963
6855
  } else if (cmp > 0) {
@@ -5970,65 +6862,80 @@ break;
5970
6862
  if (idx < 0) {
5971
6863
  idx = end + 1;
5972
6864
  }
5973
- this._instances.splice(idx, 0, this._insertRow(idx, key, pool));
6865
+ this._insertPlaceholder(idx, key);
5974
6866
  return idx;
5975
6867
  },
5976
6868
  _applySplicesArrayOrder: function (splices) {
5977
- var pool = [];
5978
6869
  var c = this.collection;
5979
- splices.forEach(function (s) {
5980
- for (var i = 0; i < s.removed.length; i++) {
5981
- var inst = this._detachRow(s.index + i);
5982
- if (!inst.isPlaceholder) {
5983
- pool.push(inst);
5984
- }
6870
+ for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
6871
+ for (var j = 0; j < s.removed.length; j++) {
6872
+ this._detachAndRemoveInstance(s.index);
5985
6873
  }
5986
- this._instances.splice(s.index, s.removed.length);
5987
- for (var i = 0; i < s.addedKeys.length; i++) {
5988
- var inst = {
5989
- isPlaceholder: true,
5990
- key: s.addedKeys[i]
5991
- };
5992
- this._instances.splice(s.index + i, 0, inst);
5993
- }
5994
- }, this);
5995
- for (var i = this._instances.length - 1; i >= 0; i--) {
5996
- var inst = this._instances[i];
5997
- if (inst.isPlaceholder) {
5998
- this._instances[i] = this._insertRow(i, inst.key, pool, true);
6874
+ for (var j = 0; j < s.addedKeys.length; j++) {
6875
+ this._insertPlaceholder(s.index + j, s.addedKeys[j]);
5999
6876
  }
6000
6877
  }
6001
6878
  },
6002
- _detachRow: function (idx) {
6879
+ _detachInstance: function (idx) {
6003
6880
  var inst = this._instances[idx];
6004
6881
  if (!inst.isPlaceholder) {
6005
- var parentNode = Polymer.dom(this).parentNode;
6006
6882
  for (var i = 0; i < inst._children.length; i++) {
6007
6883
  var el = inst._children[i];
6008
6884
  Polymer.dom(inst.root).appendChild(el);
6009
6885
  }
6010
- }
6011
6886
  return inst;
6887
+ }
6888
+ },
6889
+ _attachInstance: function (idx, parent) {
6890
+ var inst = this._instances[idx];
6891
+ if (!inst.isPlaceholder) {
6892
+ parent.insertBefore(inst.root, this);
6893
+ }
6894
+ },
6895
+ _detachAndRemoveInstance: function (idx) {
6896
+ var inst = this._detachInstance(idx);
6897
+ if (inst) {
6898
+ this._pool.push(inst);
6899
+ }
6900
+ this._instances.splice(idx, 1);
6901
+ },
6902
+ _insertPlaceholder: function (idx, key) {
6903
+ this._instances.splice(idx, 0, {
6904
+ isPlaceholder: true,
6905
+ __key__: key
6906
+ });
6907
+ },
6908
+ _stampInstance: function (idx, key) {
6909
+ var model = { __key__: key };
6910
+ model[this.as] = this.collection.getItem(key);
6911
+ model[this.indexAs] = idx;
6912
+ return this.stamp(model);
6012
6913
  },
6013
- _insertRow: function (idx, key, pool, replace) {
6014
- var inst;
6015
- if (inst = pool && pool.pop()) {
6914
+ _insertInstance: function (idx, key) {
6915
+ var inst = this._pool.pop();
6916
+ if (inst) {
6016
6917
  inst.__setProperty(this.as, this.collection.getItem(key), true);
6017
6918
  inst.__setProperty('__key__', key, true);
6018
6919
  } else {
6019
- inst = this._generateRow(idx, key);
6920
+ inst = this._stampInstance(idx, key);
6020
6921
  }
6021
- var beforeRow = this._instances[replace ? idx + 1 : idx];
6022
- var beforeNode = beforeRow ? beforeRow._children[0] : this;
6922
+ var beforeRow = this._instances[idx + 1];
6923
+ var beforeNode = beforeRow && !beforeRow.isPlaceholder ? beforeRow._children[0] : this;
6023
6924
  var parentNode = Polymer.dom(this).parentNode;
6024
6925
  Polymer.dom(parentNode).insertBefore(inst.root, beforeNode);
6926
+ this._instances[idx] = inst;
6025
6927
  return inst;
6026
6928
  },
6027
- _generateRow: function (idx, key) {
6028
- var model = { __key__: key };
6029
- model[this.as] = this.collection.getItem(key);
6030
- model[this.indexAs] = idx;
6031
- var inst = this.stamp(model);
6929
+ _downgradeInstance: function (idx, key) {
6930
+ var inst = this._detachInstance(idx);
6931
+ if (inst) {
6932
+ this._pool.push(inst);
6933
+ }
6934
+ inst = {
6935
+ isPlaceholder: true,
6936
+ __key__: key
6937
+ };
6938
+ this._instances[idx] = inst;
6032
6939
  return inst;
6033
6940
  },
6034
6941
  _showHideChildren: function (hidden) {
@@ -6049,18 +6956,24 @@ this.set('items.' + idx, value);
6049
6956
  },
6050
6957
  _forwardInstancePath: function (inst, path, value) {
6051
6958
  if (path.indexOf(this.as + '.') === 0) {
6052
- this.notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value);
6959
+ this._notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value);
6053
6960
  }
6054
6961
  },
6055
6962
  _forwardParentProp: function (prop, value) {
6056
- this._instances.forEach(function (inst) {
6963
+ var i$ = this._instances;
6964
+ for (var i = 0, inst; i < i$.length && (inst = i$[i]); i++) {
6965
+ if (!inst.isPlaceholder) {
6057
6966
  inst.__setProperty(prop, value, true);
6058
- }, this);
6967
+ }
6968
+ }
6059
6969
  },
6060
6970
  _forwardParentPath: function (path, value) {
6061
- this._instances.forEach(function (inst) {
6062
- inst.notifyPath(path, value, true);
6063
- }, this);
6971
+ var i$ = this._instances;
6972
+ for (var i = 0, inst; i < i$.length && (inst = i$[i]); i++) {
6973
+ if (!inst.isPlaceholder) {
6974
+ inst._notifyPath(path, value, true);
6975
+ }
6976
+ }
6064
6977
  },
6065
6978
  _forwardItemPath: function (path, value) {
6066
6979
  if (this._keyToInstIdx) {
@@ -6068,10 +6981,10 @@ var dot = path.indexOf('.');
6068
6981
  var key = path.substring(0, dot < 0 ? path.length : dot);
6069
6982
  var idx = this._keyToInstIdx[key];
6070
6983
  var inst = this._instances[idx];
6071
- if (inst) {
6984
+ if (inst && !inst.isPlaceholder) {
6072
6985
  if (dot >= 0) {
6073
6986
  path = this.as + '.' + path.substring(dot + 1);
6074
- inst.notifyPath(path, value, true);
6987
+ inst._notifyPath(path, value, true);
6075
6988
  } else {
6076
6989
  inst.__setProperty(this.as, value, true);
6077
6990
  }
@@ -6093,6 +7006,7 @@ return instance && instance[this.indexAs];
6093
7006
  });
6094
7007
  Polymer({
6095
7008
  is: 'array-selector',
7009
+ _template: null,
6096
7010
  properties: {
6097
7011
  items: {
6098
7012
  type: Array,
@@ -6123,6 +7037,7 @@ this.unlinkPaths('selected.' + i);
6123
7037
  }
6124
7038
  } else {
6125
7039
  this.unlinkPaths('selected');
7040
+ this.unlinkPaths('selectedItem');
6126
7041
  }
6127
7042
  if (this.multi) {
6128
7043
  if (!this.selected || this.selected.length) {
@@ -6166,7 +7081,7 @@ this.deselect(item);
6166
7081
  }
6167
7082
  } else {
6168
7083
  this.push('selected', item);
6169
- skey = this._selectedColl.getKey(item);
7084
+ var skey = this._selectedColl.getKey(item);
6170
7085
  this.linkPaths('selected.' + skey, 'items.' + key);
6171
7086
  }
6172
7087
  } else {
@@ -6184,6 +7099,7 @@ this.linkPaths('selectedItem', 'items.' + key);
6184
7099
  Polymer({
6185
7100
  is: 'dom-if',
6186
7101
  extends: 'template',
7102
+ _template: null,
6187
7103
  properties: {
6188
7104
  'if': {
6189
7105
  type: Boolean,
@@ -6231,20 +7147,23 @@ this._lastIf = this.if;
6231
7147
  },
6232
7148
  _ensureInstance: function () {
6233
7149
  if (!this._instance) {
7150
+ var parentNode = Polymer.dom(this).parentNode;
7151
+ if (parentNode) {
7152
+ var parent = Polymer.dom(parentNode);
6234
7153
  this._instance = this.stamp();
6235
7154
  var root = this._instance.root;
6236
- var parent = Polymer.dom(Polymer.dom(this).parentNode);
6237
7155
  parent.insertBefore(root, this);
6238
7156
  }
7157
+ }
6239
7158
  },
6240
7159
  _teardownInstance: function () {
6241
7160
  if (this._instance) {
6242
- var c = this._instance._children;
6243
- if (c) {
6244
- var parent = Polymer.dom(Polymer.dom(c[0]).parentNode);
6245
- c.forEach(function (n) {
7161
+ var c$ = this._instance._children;
7162
+ if (c$) {
7163
+ var parent = Polymer.dom(Polymer.dom(c$[0]).parentNode);
7164
+ for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
6246
7165
  parent.removeChild(n);
6247
- });
7166
+ }
6248
7167
  }
6249
7168
  this._instance = null;
6250
7169
  }
@@ -6262,15 +7181,19 @@ this._instance[prop] = value;
6262
7181
  },
6263
7182
  _forwardParentPath: function (path, value) {
6264
7183
  if (this._instance) {
6265
- this._instance.notifyPath(path, value, true);
7184
+ this._instance._notifyPath(path, value, true);
6266
7185
  }
6267
7186
  }
6268
7187
  });
6269
7188
  Polymer({
6270
7189
  is: 'dom-bind',
6271
7190
  extends: 'template',
7191
+ _template: null,
6272
7192
  created: function () {
6273
- Polymer.RenderStatus.whenReady(this._markImportsReady.bind(this));
7193
+ var self = this;
7194
+ Polymer.RenderStatus.whenReady(function () {
7195
+ self._markImportsReady();
7196
+ });
6274
7197
  },
6275
7198
  _ensureReady: function () {
6276
7199
  if (!this._readied) {
@@ -6309,7 +7232,10 @@ var config = {};
6309
7232
  for (var prop in this._propertyEffects) {
6310
7233
  config[prop] = this[prop];
6311
7234
  }
6312
- this._setupConfigure = this._setupConfigure.bind(this, config);
7235
+ var setupConfigure = this._setupConfigure;
7236
+ this._setupConfigure = function () {
7237
+ setupConfigure.call(this, config);
7238
+ };
6313
7239
  },
6314
7240
  attached: function () {
6315
7241
  if (this._importsReady) {
@@ -6328,8 +7254,9 @@ this._prepEffects();
6328
7254
  this._prepBehaviors();
6329
7255
  this._prepConfigure();
6330
7256
  this._prepBindings();
7257
+ this._prepPropertyInfo();
6331
7258
  Polymer.Base._initFeatures.call(this);
6332
- this._children = Array.prototype.slice.call(this.root.childNodes);
7259
+ this._children = Polymer.DomApi.arrayCopyChildNodes(this.root);
6333
7260
  }
6334
7261
  this._insertChildren();
6335
7262
  this.fire('dom-change');
@@ -8553,7 +9480,7 @@ if (!window.Promise) {
8553
9480
  }
8554
9481
  }
8555
9482
  };
8556
- </script><dom-module id="concerto-ticker" assetpath="contents/">
9483
+ </script><dom-module id="concerto-ticker" assetpath="/contents/">
8557
9484
  <style>
8558
9485
  :host {
8559
9486
  position: absolute;
@@ -8605,14 +9532,13 @@ if (!window.Promise) {
8605
9532
  </dom-module>
8606
9533
  <script>
8607
9534
  ConcertoBehaviors.ContentFactory.registerContent("concerto-ticker", "ConcertoTicker");
8608
- </script><dom-module id="concerto-graphic" assetpath="contents/">
9535
+ </script><dom-module id="concerto-graphic" assetpath="/contents/">
8609
9536
  <style>
8610
9537
  :host {
8611
9538
  display: block;
8612
9539
  position: absolute;
8613
9540
  width: 100%;
8614
9541
  height: 100%;
8615
- text-align: center;
8616
9542
  }
8617
9543
 
8618
9544
  .portrait {
@@ -8624,10 +9550,12 @@ if (!window.Promise) {
8624
9550
  }
8625
9551
 
8626
9552
  img {
8627
- /** I do not understand this centering voodoo */
8628
- position: relative;
8629
- top: 50%;
8630
- transform: translateY(-50%);
9553
+ position: absolute;
9554
+ margin: auto;
9555
+ top: 0;
9556
+ left: 0;
9557
+ right: 0;
9558
+ bottom: 0;
8631
9559
  }
8632
9560
  </style>
8633
9561
 
@@ -8709,7 +9637,7 @@ if (!window.Promise) {
8709
9637
  </dom-module>
8710
9638
  <script>
8711
9639
  ConcertoBehaviors.ContentFactory.registerContent("concerto-graphic", "ConcertoGraphic");
8712
- </script><dom-module id="concerto-htmltext" assetpath="contents/">
9640
+ </script><dom-module id="concerto-htmltext" assetpath="/contents/">
8713
9641
  <style>
8714
9642
  :host {
8715
9643
  position: absolute;
@@ -8760,7 +9688,7 @@ if (!window.Promise) {
8760
9688
 
8761
9689
  <script>
8762
9690
  ConcertoBehaviors.ContentFactory.registerContent("concerto-htmltext", "ConcertoHtmlText");
8763
- </script></dom-module><dom-module id="concerto-client-time" assetpath="contents/">
9691
+ </script></dom-module><dom-module id="concerto-client-time" assetpath="/contents/">
8764
9692
  <style>
8765
9693
  :host {
8766
9694
  position: absolute;
@@ -8826,7 +9754,7 @@ if (!window.Promise) {
8826
9754
 
8827
9755
  <script>
8828
9756
  ConcertoBehaviors.ContentFactory.registerContent("concerto-client-time", "ConcertoClientTime");
8829
- </script><dom-module id="concerto-empty" assetpath="contents/">
9757
+ </script><dom-module id="concerto-empty" assetpath="/contents/">
8830
9758
  <style>
8831
9759
  :host {
8832
9760
  position: absolute;
@@ -8860,7 +9788,7 @@ if (!window.Promise) {
8860
9788
 
8861
9789
  <script>
8862
9790
  ConcertoBehaviors.ContentFactory.registerContent("concerto-empty", "ConcertoEmpty");
8863
- </script></dom-module><dom-module id="concerto-field" assetpath="/">
9791
+ </script></dom-module><dom-module id="concerto-field" assetpath="//">
8864
9792
 
8865
9793
  <style>
8866
9794
  :host {
@@ -9209,7 +10137,7 @@ if (!window.Promise) {
9209
10137
  });
9210
10138
  </script>
9211
10139
 
9212
- </dom-module><dom-module id="concerto-screen" assetpath="/">
10140
+ </dom-module><dom-module id="concerto-screen" assetpath="//">
9213
10141
 
9214
10142
  <style>
9215
10143
  :host {