| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --><!-- | 9 --><!-- |
| 10 @license | 10 @license |
| 11 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 11 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 12 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 12 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 13 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 13 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 14 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 14 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 15 Code distributed by Google as part of the polymer project is also | 15 Code distributed by Google as part of the polymer project is also |
| 16 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 16 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 17 --><link rel="import" href="polymer-mini.html"> | 17 --><link rel="import" href="polymer-mini.html"> |
| 18 | 18 |
| 19 | |
| 20 | |
| 21 <script>Polymer.nar = []; | 19 <script>Polymer.nar = []; |
| 22 Polymer.Annotations = { | 20 Polymer.Annotations = { |
| 23 parseAnnotations: function (template) { | 21 parseAnnotations: function (template) { |
| 24 var list = []; | 22 var list = []; |
| 25 var content = template._content || template.content; | 23 var content = template._content || template.content; |
| 26 this._parseNodeAnnotations(content, list, template.hasAttribute('strip-whitespac
e')); | 24 this._parseNodeAnnotations(content, list, template.hasAttribute('strip-whitespac
e')); |
| 27 return list; | 25 return list; |
| 28 }, | 26 }, |
| 29 _parseNodeAnnotations: function (node, list, stripWhiteSpace) { | 27 _parseNodeAnnotations: function (node, list, stripWhiteSpace) { |
| 30 return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, li
st) : this._parseElementAnnotations(node, list, stripWhiteSpace); | 28 return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, li
st) : this._parseElementAnnotations(node, list, stripWhiteSpace); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if (parent) { | 226 if (parent) { |
| 229 for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) { | 227 for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) { |
| 230 if (annote.index === i++) { | 228 if (annote.index === i++) { |
| 231 return n; | 229 return n; |
| 232 } | 230 } |
| 233 } | 231 } |
| 234 } else { | 232 } else { |
| 235 return root; | 233 return root; |
| 236 } | 234 } |
| 237 } | 235 } |
| 238 }; | 236 };(function () { |
| 239 (function () { | |
| 240 function resolveCss(cssText, ownerDocument) { | 237 function resolveCss(cssText, ownerDocument) { |
| 241 return cssText.replace(CSS_URL_RX, function (m, pre, url, post) { | 238 return cssText.replace(CSS_URL_RX, function (m, pre, url, post) { |
| 242 return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + po
st; | 239 return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + po
st; |
| 243 }); | 240 }); |
| 244 } | 241 } |
| 245 function resolveAttrs(element, ownerDocument) { | 242 function resolveAttrs(element, ownerDocument) { |
| 246 for (var name in URL_ATTRS) { | 243 for (var name in URL_ATTRS) { |
| 247 var a$ = URL_ATTRS[name]; | 244 var a$ = URL_ATTRS[name]; |
| 248 for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) { | 245 for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) { |
| 249 if (name === '*' || element.localName === name) { | 246 if (name === '*' || element.localName === name) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 'url' | 284 'url' |
| 288 ], | 285 ], |
| 289 form: ['action'] | 286 form: ['action'] |
| 290 }; | 287 }; |
| 291 var BINDING_RX = /\{\{|\[\[/; | 288 var BINDING_RX = /\{\{|\[\[/; |
| 292 Polymer.ResolveUrl = { | 289 Polymer.ResolveUrl = { |
| 293 resolveCss: resolveCss, | 290 resolveCss: resolveCss, |
| 294 resolveAttrs: resolveAttrs, | 291 resolveAttrs: resolveAttrs, |
| 295 resolveUrl: resolveUrl | 292 resolveUrl: resolveUrl |
| 296 }; | 293 }; |
| 297 }()); | 294 }());Polymer.Base._addFeature({ |
| 298 Polymer.Base._addFeature({ | |
| 299 _prepAnnotations: function () { | 295 _prepAnnotations: function () { |
| 300 if (!this._template) { | 296 if (!this._template) { |
| 301 this._notes = []; | 297 this._notes = []; |
| 302 } else { | 298 } else { |
| 303 var self = this; | 299 var self = this; |
| 304 Polymer.Annotations.prepElement = function (element) { | 300 Polymer.Annotations.prepElement = function (element) { |
| 305 self._prepElement(element); | 301 self._prepElement(element); |
| 306 }; | 302 }; |
| 307 if (this._template._content && this._template._content._notes) { | 303 if (this._template._content && this._template._content._notes) { |
| 308 this._notes = this._template._content._notes; | 304 this._notes = this._template._content._notes; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 328 p.model = this._modelForPath(p.value); | 324 p.model = this._modelForPath(p.value); |
| 329 } | 325 } |
| 330 } | 326 } |
| 331 } | 327 } |
| 332 } | 328 } |
| 333 if (note.templateContent) { | 329 if (note.templateContent) { |
| 334 this._processAnnotations(note.templateContent._notes); | 330 this._processAnnotations(note.templateContent._notes); |
| 335 var pp = note.templateContent._parentProps = this._discoverTemplateParentProps(n
ote.templateContent._notes); | 331 var pp = note.templateContent._parentProps = this._discoverTemplateParentProps(n
ote.templateContent._notes); |
| 336 var bindings = []; | 332 var bindings = []; |
| 337 for (var prop in pp) { | 333 for (var prop in pp) { |
| 334 var name = '_parent_' + prop; |
| 338 bindings.push({ | 335 bindings.push({ |
| 339 index: note.index, | 336 index: note.index, |
| 340 kind: 'property', | 337 kind: 'property', |
| 341 name: '_parent_' + prop, | 338 name: name, |
| 339 propertyName: name, |
| 342 parts: [{ | 340 parts: [{ |
| 343 mode: '{', | 341 mode: '{', |
| 344 model: prop, | 342 model: prop, |
| 345 value: prop | 343 value: prop |
| 346 }] | 344 }] |
| 347 }); | 345 }); |
| 348 } | 346 } |
| 349 note.bindings = note.bindings.concat(bindings); | 347 note.bindings = note.bindings.concat(bindings); |
| 350 } | 348 } |
| 351 } | 349 } |
| 352 }, | 350 }, |
| 353 _discoverTemplateParentProps: function (notes) { | 351 _discoverTemplateParentProps: function (notes) { |
| 354 var pp = {}; | 352 var pp = {}; |
| 355 for (var i = 0, n; i < notes.length && (n = notes[i]); i++) { | 353 for (var i = 0, n; i < notes.length && (n = notes[i]); i++) { |
| 356 for (var j = 0, b$ = n.bindings, b; j < b$.length && (b = b$[j]); j++) { | 354 for (var j = 0, b$ = n.bindings, b; j < b$.length && (b = b$[j]); j++) { |
| 357 for (var k = 0, p$ = b.parts, p; k < p$.length && (p = p$[k]); k++) { | 355 for (var k = 0, p$ = b.parts, p; k < p$.length && (p = p$[k]); k++) { |
| 358 if (p.signature) { | 356 if (p.signature) { |
| 359 var args = p.signature.args; | 357 var args = p.signature.args; |
| 360 for (var kk = 0; kk < args.length; kk++) { | 358 for (var kk = 0; kk < args.length; kk++) { |
| 361 var model = args[kk].model; | 359 var model = args[kk].model; |
| 362 if (model) { | 360 if (model) { |
| 363 pp[model] = true; | 361 pp[model] = true; |
| 364 } | 362 } |
| 365 } | 363 } |
| 364 if (p.signature.dynamicFn) { |
| 365 pp[p.signature.method] = true; |
| 366 } |
| 366 } else { | 367 } else { |
| 367 if (p.model) { | 368 if (p.model) { |
| 368 pp[p.model] = true; | 369 pp[p.model] = true; |
| 369 } | 370 } |
| 370 } | 371 } |
| 371 } | 372 } |
| 372 } | 373 } |
| 373 if (n.templateContent) { | 374 if (n.templateContent) { |
| 374 var tpp = n.templateContent._parentProps; | 375 var tpp = n.templateContent._parentProps; |
| 375 Polymer.Base.mixin(pp, tpp); | 376 Polymer.Base.mixin(pp, tpp); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 _marshalAnnotatedListeners: function () { | 447 _marshalAnnotatedListeners: function () { |
| 447 for (var i = 0, l = this._notes.length, a; i < l && (a = this._notes[i]); i++) { | 448 for (var i = 0, l = this._notes.length, a; i < l && (a = this._notes[i]); i++) { |
| 448 if (a.events && a.events.length) { | 449 if (a.events && a.events.length) { |
| 449 var node = this._findAnnotatedNode(this.root, a); | 450 var node = this._findAnnotatedNode(this.root, a); |
| 450 for (var j = 0, e$ = a.events, e; j < e$.length && (e = e$[j]); j++) { | 451 for (var j = 0, e$ = a.events, e; j < e$.length && (e = e$[j]); j++) { |
| 451 this.listen(node, e.name, e.value); | 452 this.listen(node, e.name, e.value); |
| 452 } | 453 } |
| 453 } | 454 } |
| 454 } | 455 } |
| 455 } | 456 } |
| 456 }); | 457 });Polymer.Base._addFeature({ |
| 457 Polymer.Base._addFeature({ | |
| 458 listeners: {}, | 458 listeners: {}, |
| 459 _listenListeners: function (listeners) { | 459 _listenListeners: function (listeners) { |
| 460 var node, name, eventName; | 460 var node, name, eventName; |
| 461 for (eventName in listeners) { | 461 for (eventName in listeners) { |
| 462 if (eventName.indexOf('.') < 0) { | 462 if (eventName.indexOf('.') < 0) { |
| 463 node = this; | 463 node = this; |
| 464 name = eventName; | 464 name = eventName; |
| 465 } else { | 465 } else { |
| 466 name = eventName.split('.'); | 466 name = eventName.split('.'); |
| 467 node = this.$[name[0]]; | 467 node = this.$[name[0]]; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 this._unlisten(node, eventName, handler); | 528 this._unlisten(node, eventName, handler); |
| 529 handler._listening = false; | 529 handler._listening = false; |
| 530 } | 530 } |
| 531 }, | 531 }, |
| 532 _listen: function (node, eventName, handler) { | 532 _listen: function (node, eventName, handler) { |
| 533 node.addEventListener(eventName, handler); | 533 node.addEventListener(eventName, handler); |
| 534 }, | 534 }, |
| 535 _unlisten: function (node, eventName, handler) { | 535 _unlisten: function (node, eventName, handler) { |
| 536 node.removeEventListener(eventName, handler); | 536 node.removeEventListener(eventName, handler); |
| 537 } | 537 } |
| 538 }); | 538 });(function () { |
| 539 (function () { | |
| 540 'use strict'; | 539 'use strict'; |
| 541 var wrap = Polymer.DomApi.wrap; | 540 var wrap = Polymer.DomApi.wrap; |
| 542 var HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string'; | 541 var HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string'; |
| 543 var GESTURE_KEY = '__polymerGestures'; | 542 var GESTURE_KEY = '__polymerGestures'; |
| 544 var HANDLED_OBJ = '__polymerGesturesHandled'; | 543 var HANDLED_OBJ = '__polymerGesturesHandled'; |
| 545 var TOUCH_ACTION = '__polymerGesturesTouchAction'; | 544 var TOUCH_ACTION = '__polymerGesturesTouchAction'; |
| 546 var TAP_DISTANCE = 25; | 545 var TAP_DISTANCE = 25; |
| 547 var TRACK_DISTANCE = 5; | 546 var TRACK_DISTANCE = 5; |
| 548 var TRACK_LENGTH = 2; | 547 var TRACK_LENGTH = 2; |
| 549 var MOUSE_TIMEOUT = 2500; | 548 var MOUSE_TIMEOUT = 2500; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 } | 709 } |
| 711 } | 710 } |
| 712 if (POINTERSTATE.touch.id !== t.identifier) { | 711 if (POINTERSTATE.touch.id !== t.identifier) { |
| 713 return; | 712 return; |
| 714 } | 713 } |
| 715 if (!HAS_NATIVE_TA) { | 714 if (!HAS_NATIVE_TA) { |
| 716 if (type === 'touchstart' || type === 'touchmove') { | 715 if (type === 'touchstart' || type === 'touchmove') { |
| 717 Gestures.handleTouchAction(ev); | 716 Gestures.handleTouchAction(ev); |
| 718 } | 717 } |
| 719 } | 718 } |
| 720 if (type === 'touchend' && !ev.__polymerSimulatedTouch) { | 719 if (type === 'touchend') { |
| 721 POINTERSTATE.mouse.target = Polymer.dom(ev).rootTarget; | 720 POINTERSTATE.mouse.target = Polymer.dom(ev).rootTarget; |
| 722 ignoreMouse(true); | 721 ignoreMouse(); |
| 723 } | 722 } |
| 724 } | 723 } |
| 725 } | 724 } |
| 726 handled = ev[HANDLED_OBJ]; | 725 handled = ev[HANDLED_OBJ]; |
| 727 if (handled.skip) { | 726 if (handled.skip) { |
| 728 return; | 727 return; |
| 729 } | 728 } |
| 730 var recognizers = Gestures.recognizers; | 729 var recognizers = Gestures.recognizers; |
| 731 for (var i = 0, r; i < recognizers.length; i++) { | 730 for (var i = 0, r; i < recognizers.length; i++) { |
| 732 r = recognizers[i]; | 731 r = recognizers[i]; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 } | 848 } |
| 850 node[TOUCH_ACTION] = value; | 849 node[TOUCH_ACTION] = value; |
| 851 }, | 850 }, |
| 852 fire: function (target, type, detail) { | 851 fire: function (target, type, detail) { |
| 853 var ev = Polymer.Base.fire(type, detail, { | 852 var ev = Polymer.Base.fire(type, detail, { |
| 854 node: target, | 853 node: target, |
| 855 bubbles: true, | 854 bubbles: true, |
| 856 cancelable: true | 855 cancelable: true |
| 857 }); | 856 }); |
| 858 if (ev.defaultPrevented) { | 857 if (ev.defaultPrevented) { |
| 859 var se = detail.sourceEvent; | 858 var preventer = detail.preventer || detail.sourceEvent; |
| 860 if (se && se.preventDefault) { | 859 if (preventer && preventer.preventDefault) { |
| 861 se.preventDefault(); | 860 preventer.preventDefault(); |
| 862 } | 861 } |
| 863 } | 862 } |
| 864 }, | 863 }, |
| 865 prevent: function (evName) { | 864 prevent: function (evName) { |
| 866 var recognizer = this.findRecognizerByEvent(evName); | 865 var recognizer = this.findRecognizerByEvent(evName); |
| 867 if (recognizer.info) { | 866 if (recognizer.info) { |
| 868 recognizer.info.prevent = true; | 867 recognizer.info.prevent = true; |
| 869 } | 868 } |
| 869 }, |
| 870 resetMouseCanceller: function () { |
| 871 if (POINTERSTATE.mouse.mouseIgnoreJob) { |
| 872 POINTERSTATE.mouse.mouseIgnoreJob.complete(); |
| 873 } |
| 870 } | 874 } |
| 871 }; | 875 }; |
| 872 Gestures.register({ | 876 Gestures.register({ |
| 873 name: 'downup', | 877 name: 'downup', |
| 874 deps: [ | 878 deps: [ |
| 875 'mousedown', | 879 'mousedown', |
| 876 'touchstart', | 880 'touchstart', |
| 877 'touchend' | 881 'touchend' |
| 878 ], | 882 ], |
| 879 flow: { | 883 flow: { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 var upfn = function upfn(e) { | 916 var upfn = function upfn(e) { |
| 913 if (hasLeftMouseButton(e)) { | 917 if (hasLeftMouseButton(e)) { |
| 914 self.fire('up', t, e); | 918 self.fire('up', t, e); |
| 915 } | 919 } |
| 916 untrackDocument(self.info); | 920 untrackDocument(self.info); |
| 917 }; | 921 }; |
| 918 trackDocument(this.info, movefn, upfn); | 922 trackDocument(this.info, movefn, upfn); |
| 919 this.fire('down', t, e); | 923 this.fire('down', t, e); |
| 920 }, | 924 }, |
| 921 touchstart: function (e) { | 925 touchstart: function (e) { |
| 922 this.fire('down', Gestures.findOriginalTarget(e), e.changedTouches[0]); | 926 this.fire('down', Gestures.findOriginalTarget(e), e.changedTouches[0], e); |
| 923 }, | 927 }, |
| 924 touchend: function (e) { | 928 touchend: function (e) { |
| 925 this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]); | 929 this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0], e); |
| 926 }, | 930 }, |
| 927 fire: function (type, target, event) { | 931 fire: function (type, target, event, preventer) { |
| 928 Gestures.fire(target, type, { | 932 Gestures.fire(target, type, { |
| 929 x: event.clientX, | 933 x: event.clientX, |
| 930 y: event.clientY, | 934 y: event.clientY, |
| 931 sourceEvent: event, | 935 sourceEvent: event, |
| 936 preventer: preventer, |
| 932 prevent: function (e) { | 937 prevent: function (e) { |
| 933 return Gestures.prevent(e); | 938 return Gestures.prevent(e); |
| 934 } | 939 } |
| 935 }); | 940 }); |
| 936 } | 941 } |
| 937 }); | 942 }); |
| 938 Gestures.register({ | 943 Gestures.register({ |
| 939 name: 'track', | 944 name: 'track', |
| 940 touchAction: 'none', | 945 touchAction: 'none', |
| 941 deps: [ | 946 deps: [ |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 }, | 1055 }, |
| 1051 touchend: function (e) { | 1056 touchend: function (e) { |
| 1052 var t = Gestures.findOriginalTarget(e); | 1057 var t = Gestures.findOriginalTarget(e); |
| 1053 var ct = e.changedTouches[0]; | 1058 var ct = e.changedTouches[0]; |
| 1054 if (this.info.started) { | 1059 if (this.info.started) { |
| 1055 this.info.state = 'end'; | 1060 this.info.state = 'end'; |
| 1056 this.info.addMove({ | 1061 this.info.addMove({ |
| 1057 x: ct.clientX, | 1062 x: ct.clientX, |
| 1058 y: ct.clientY | 1063 y: ct.clientY |
| 1059 }); | 1064 }); |
| 1060 this.fire(t, ct); | 1065 this.fire(t, ct, e); |
| 1061 } | 1066 } |
| 1062 }, | 1067 }, |
| 1063 fire: function (target, touch) { | 1068 fire: function (target, touch, preventer) { |
| 1064 var secondlast = this.info.moves[this.info.moves.length - 2]; | 1069 var secondlast = this.info.moves[this.info.moves.length - 2]; |
| 1065 var lastmove = this.info.moves[this.info.moves.length - 1]; | 1070 var lastmove = this.info.moves[this.info.moves.length - 1]; |
| 1066 var dx = lastmove.x - this.info.x; | 1071 var dx = lastmove.x - this.info.x; |
| 1067 var dy = lastmove.y - this.info.y; | 1072 var dy = lastmove.y - this.info.y; |
| 1068 var ddx, ddy = 0; | 1073 var ddx, ddy = 0; |
| 1069 if (secondlast) { | 1074 if (secondlast) { |
| 1070 ddx = lastmove.x - secondlast.x; | 1075 ddx = lastmove.x - secondlast.x; |
| 1071 ddy = lastmove.y - secondlast.y; | 1076 ddy = lastmove.y - secondlast.y; |
| 1072 } | 1077 } |
| 1073 return Gestures.fire(target, 'track', { | 1078 return Gestures.fire(target, 'track', { |
| 1074 state: this.info.state, | 1079 state: this.info.state, |
| 1075 x: touch.clientX, | 1080 x: touch.clientX, |
| 1076 y: touch.clientY, | 1081 y: touch.clientY, |
| 1077 dx: dx, | 1082 dx: dx, |
| 1078 dy: dy, | 1083 dy: dy, |
| 1079 ddx: ddx, | 1084 ddx: ddx, |
| 1080 ddy: ddy, | 1085 ddy: ddy, |
| 1081 sourceEvent: touch, | 1086 sourceEvent: touch, |
| 1087 preventer: preventer, |
| 1082 hover: function () { | 1088 hover: function () { |
| 1083 return Gestures.deepTargetFind(touch.clientX, touch.clientY); | 1089 return Gestures.deepTargetFind(touch.clientX, touch.clientY); |
| 1084 } | 1090 } |
| 1085 }); | 1091 }); |
| 1086 } | 1092 } |
| 1087 }); | 1093 }); |
| 1088 Gestures.register({ | 1094 Gestures.register({ |
| 1089 name: 'tap', | 1095 name: 'tap', |
| 1090 deps: [ | 1096 deps: [ |
| 1091 'mousedown', | 1097 'mousedown', |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1122 if (hasLeftMouseButton(e)) { | 1128 if (hasLeftMouseButton(e)) { |
| 1123 this.save(e); | 1129 this.save(e); |
| 1124 } | 1130 } |
| 1125 }, | 1131 }, |
| 1126 click: function (e) { | 1132 click: function (e) { |
| 1127 if (hasLeftMouseButton(e)) { | 1133 if (hasLeftMouseButton(e)) { |
| 1128 this.forward(e); | 1134 this.forward(e); |
| 1129 } | 1135 } |
| 1130 }, | 1136 }, |
| 1131 touchstart: function (e) { | 1137 touchstart: function (e) { |
| 1132 this.save(e.changedTouches[0]); | 1138 this.save(e.changedTouches[0], e); |
| 1133 }, | 1139 }, |
| 1134 touchend: function (e) { | 1140 touchend: function (e) { |
| 1135 this.forward(e.changedTouches[0]); | 1141 this.forward(e.changedTouches[0], e); |
| 1136 }, | 1142 }, |
| 1137 forward: function (e) { | 1143 forward: function (e, preventer) { |
| 1138 var dx = Math.abs(e.clientX - this.info.x); | 1144 var dx = Math.abs(e.clientX - this.info.x); |
| 1139 var dy = Math.abs(e.clientY - this.info.y); | 1145 var dy = Math.abs(e.clientY - this.info.y); |
| 1140 var t = Gestures.findOriginalTarget(e); | 1146 var t = Gestures.findOriginalTarget(e); |
| 1141 if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE || isSynt
heticClick(e)) { | 1147 if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE || isSynt
heticClick(e)) { |
| 1142 if (!this.info.prevent) { | 1148 if (!this.info.prevent) { |
| 1143 Gestures.fire(t, 'tap', { | 1149 Gestures.fire(t, 'tap', { |
| 1144 x: e.clientX, | 1150 x: e.clientX, |
| 1145 y: e.clientY, | 1151 y: e.clientY, |
| 1146 sourceEvent: e | 1152 sourceEvent: e, |
| 1153 preventer: preventer |
| 1147 }); | 1154 }); |
| 1148 } | 1155 } |
| 1149 } | 1156 } |
| 1150 } | 1157 } |
| 1151 }); | 1158 }); |
| 1152 var DIRECTION_MAP = { | 1159 var DIRECTION_MAP = { |
| 1153 x: 'pan-x', | 1160 x: 'pan-x', |
| 1154 y: 'pan-y', | 1161 y: 'pan-y', |
| 1155 none: 'none', | 1162 none: 'none', |
| 1156 all: 'auto' | 1163 all: 'auto' |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1172 } else { | 1179 } else { |
| 1173 node.removeEventListener(eventName, handler); | 1180 node.removeEventListener(eventName, handler); |
| 1174 } | 1181 } |
| 1175 }, | 1182 }, |
| 1176 setScrollDirection: function (direction, node) { | 1183 setScrollDirection: function (direction, node) { |
| 1177 node = node || this; | 1184 node = node || this; |
| 1178 Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto'); | 1185 Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto'); |
| 1179 } | 1186 } |
| 1180 }); | 1187 }); |
| 1181 Polymer.Gestures = Gestures; | 1188 Polymer.Gestures = Gestures; |
| 1182 }()); | 1189 }());(function () { |
| 1190 'use strict'; |
| 1183 Polymer.Base._addFeature({ | 1191 Polymer.Base._addFeature({ |
| 1184 $$: function (slctr) { | 1192 $$: function (slctr) { |
| 1185 return Polymer.dom(this.root).querySelector(slctr); | 1193 return Polymer.dom(this.root).querySelector(slctr); |
| 1186 }, | 1194 }, |
| 1187 toggleClass: function (name, bool, node) { | 1195 toggleClass: function (name, bool, node) { |
| 1188 node = node || this; | 1196 node = node || this; |
| 1189 if (arguments.length == 1) { | 1197 if (arguments.length == 1) { |
| 1190 bool = !node.classList.contains(name); | 1198 bool = !node.classList.contains(name); |
| 1191 } | 1199 } |
| 1192 if (bool) { | 1200 if (bool) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 transform: function (transform, node) { | 1321 transform: function (transform, node) { |
| 1314 node = node || this; | 1322 node = node || this; |
| 1315 node.style.webkitTransform = transform; | 1323 node.style.webkitTransform = transform; |
| 1316 node.style.transform = transform; | 1324 node.style.transform = transform; |
| 1317 }, | 1325 }, |
| 1318 translate3d: function (x, y, z, node) { | 1326 translate3d: function (x, y, z, node) { |
| 1319 node = node || this; | 1327 node = node || this; |
| 1320 this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node); | 1328 this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node); |
| 1321 }, | 1329 }, |
| 1322 importHref: function (href, onload, onerror, optAsync) { | 1330 importHref: function (href, onload, onerror, optAsync) { |
| 1323 var l = document.createElement('link'); | 1331 var link = document.createElement('link'); |
| 1324 l.rel = 'import'; | 1332 link.rel = 'import'; |
| 1325 l.href = href; | 1333 link.href = href; |
| 1334 var list = Polymer.Base.importHref.imported = Polymer.Base.importHref.imported |
| {}; |
| 1335 var cached = list[link.href]; |
| 1336 var imprt = cached || link; |
| 1337 var self = this; |
| 1338 if (onload) { |
| 1339 var loadListener = function (e) { |
| 1340 e.target.__firedLoad = true; |
| 1341 e.target.removeEventListener('load', loadListener); |
| 1342 return onload.call(self, e); |
| 1343 }; |
| 1344 imprt.addEventListener('load', loadListener); |
| 1345 } |
| 1346 if (onerror) { |
| 1347 var errorListener = function (e) { |
| 1348 e.target.__firedError = true; |
| 1349 e.target.removeEventListener('error', errorListener); |
| 1350 return onerror.call(self, e); |
| 1351 }; |
| 1352 imprt.addEventListener('error', errorListener); |
| 1353 } |
| 1354 if (cached) { |
| 1355 if (cached.__firedLoad) { |
| 1356 cached.dispatchEvent(new Event('load')); |
| 1357 } |
| 1358 if (cached.__firedError) { |
| 1359 cached.dispatchEvent(new Event('error')); |
| 1360 } |
| 1361 } else { |
| 1362 list[link.href] = link; |
| 1326 optAsync = Boolean(optAsync); | 1363 optAsync = Boolean(optAsync); |
| 1327 if (optAsync) { | 1364 if (optAsync) { |
| 1328 l.setAttribute('async', ''); | 1365 link.setAttribute('async', ''); |
| 1329 } | 1366 } |
| 1330 var self = this; | 1367 document.head.appendChild(link); |
| 1331 if (onload) { | |
| 1332 l.onload = function (e) { | |
| 1333 return onload.call(self, e); | |
| 1334 }; | |
| 1335 } | 1368 } |
| 1336 if (onerror) { | 1369 return imprt; |
| 1337 l.onerror = function (e) { | |
| 1338 return onerror.call(self, e); | |
| 1339 }; | |
| 1340 } | |
| 1341 document.head.appendChild(l); | |
| 1342 return l; | |
| 1343 }, | 1370 }, |
| 1344 create: function (tag, props) { | 1371 create: function (tag, props) { |
| 1345 var elt = document.createElement(tag); | 1372 var elt = document.createElement(tag); |
| 1346 if (props) { | 1373 if (props) { |
| 1347 for (var n in props) { | 1374 for (var n in props) { |
| 1348 elt[n] = props[n]; | 1375 elt[n] = props[n]; |
| 1349 } | 1376 } |
| 1350 } | 1377 } |
| 1351 return elt; | 1378 return elt; |
| 1352 }, | 1379 }, |
| 1353 isLightDescendant: function (node) { | 1380 isLightDescendant: function (node) { |
| 1354 return this !== node && this.contains(node) && Polymer.dom(this).getOwnerRoot()
=== Polymer.dom(node).getOwnerRoot(); | 1381 return this !== node && this.contains(node) && Polymer.dom(this).getOwnerRoot()
=== Polymer.dom(node).getOwnerRoot(); |
| 1355 }, | 1382 }, |
| 1356 isLocalDescendant: function (node) { | 1383 isLocalDescendant: function (node) { |
| 1357 return this.root === Polymer.dom(node).getOwnerRoot(); | 1384 return this.root === Polymer.dom(node).getOwnerRoot(); |
| 1358 } | 1385 } |
| 1359 }); | 1386 }); |
| 1360 Polymer.Bind = { | 1387 if (!Polymer.Settings.useNativeCustomElements) { |
| 1361 _dataEventCache: {}, | 1388 var importHref = Polymer.Base.importHref; |
| 1389 Polymer.Base.importHref = function (href, onload, onerror, optAsync) { |
| 1390 CustomElements.ready = false; |
| 1391 var loadFn = function (e) { |
| 1392 CustomElements.upgradeDocumentTree(document); |
| 1393 CustomElements.ready = true; |
| 1394 if (onload) { |
| 1395 return onload.call(this, e); |
| 1396 } |
| 1397 }; |
| 1398 return importHref.call(this, href, loadFn, onerror, optAsync); |
| 1399 }; |
| 1400 } |
| 1401 }());Polymer.Bind = { |
| 1362 prepareModel: function (model) { | 1402 prepareModel: function (model) { |
| 1363 Polymer.Base.mixin(model, this._modelApi); | 1403 Polymer.Base.mixin(model, this._modelApi); |
| 1364 }, | 1404 }, |
| 1365 _modelApi: { | 1405 _modelApi: { |
| 1366 _notifyChange: function (source, event, value) { | 1406 _notifyChange: function (source, event, value) { |
| 1367 value = value === undefined ? this[source] : value; | 1407 value = value === undefined ? this[source] : value; |
| 1368 event = event || Polymer.CaseMap.camelToDashCase(source) + '-changed'; | 1408 event = event || Polymer.CaseMap.camelToDashCase(source) + '-changed'; |
| 1369 this.fire(event, { value: value }, { | 1409 this.fire(event, { value: value }, { |
| 1370 bubbles: false, | 1410 bubbles: false, |
| 1371 cancelable: false, | 1411 cancelable: false, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1392 node = node || this; | 1432 node = node || this; |
| 1393 var effects = node._propertyEffects && node._propertyEffects[property]; | 1433 var effects = node._propertyEffects && node._propertyEffects[property]; |
| 1394 if (effects) { | 1434 if (effects) { |
| 1395 node._propertySetter(property, value, effects, quiet); | 1435 node._propertySetter(property, value, effects, quiet); |
| 1396 } else { | 1436 } else { |
| 1397 node[property] = value; | 1437 node[property] = value; |
| 1398 } | 1438 } |
| 1399 }, | 1439 }, |
| 1400 _effectEffects: function (property, value, effects, old, fromAbove) { | 1440 _effectEffects: function (property, value, effects, old, fromAbove) { |
| 1401 for (var i = 0, l = effects.length, fx; i < l && (fx = effects[i]); i++) { | 1441 for (var i = 0, l = effects.length, fx; i < l && (fx = effects[i]); i++) { |
| 1402 fx.fn.call(this, property, value, fx.effect, old, fromAbove); | 1442 fx.fn.call(this, property, this[property], fx.effect, old, fromAbove); |
| 1403 } | 1443 } |
| 1404 }, | 1444 }, |
| 1405 _clearPath: function (path) { | 1445 _clearPath: function (path) { |
| 1406 for (var prop in this.__data__) { | 1446 for (var prop in this.__data__) { |
| 1407 if (prop.indexOf(path + '.') === 0) { | 1447 if (prop.indexOf(path + '.') === 0) { |
| 1408 this.__data__[prop] = undefined; | 1448 this.__data__[prop] = undefined; |
| 1409 } | 1449 } |
| 1410 } | 1450 } |
| 1411 } | 1451 } |
| 1412 }, | 1452 }, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 for (var i = 0, l = b$.length, info; i < l && (info = b$[i]); i++) { | 1564 for (var i = 0, l = b$.length, info; i < l && (info = b$[i]); i++) { |
| 1525 var node = inst._nodes[info.index]; | 1565 var node = inst._nodes[info.index]; |
| 1526 this._addNotifyListener(node, inst, info.event, info.changedFn); | 1566 this._addNotifyListener(node, inst, info.event, info.changedFn); |
| 1527 } | 1567 } |
| 1528 }, | 1568 }, |
| 1529 _addNotifyListener: function (element, context, event, changedFn) { | 1569 _addNotifyListener: function (element, context, event, changedFn) { |
| 1530 element.addEventListener(event, function (e) { | 1570 element.addEventListener(event, function (e) { |
| 1531 return context._notifyListener(changedFn, e); | 1571 return context._notifyListener(changedFn, e); |
| 1532 }); | 1572 }); |
| 1533 } | 1573 } |
| 1534 }; | 1574 };Polymer.Base.extend(Polymer.Bind, { |
| 1535 Polymer.Base.extend(Polymer.Bind, { | |
| 1536 _shouldAddListener: function (effect) { | 1575 _shouldAddListener: function (effect) { |
| 1537 return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !ef
fect.isCompound && effect.parts[0].mode === '{'; | 1576 return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !ef
fect.isCompound && effect.parts[0].mode === '{'; |
| 1538 }, | 1577 }, |
| 1539 _annotationEffect: function (source, value, effect) { | 1578 _annotationEffect: function (source, value, effect) { |
| 1540 if (source != effect.value) { | 1579 if (source != effect.value) { |
| 1541 value = this._get(effect.value); | 1580 value = this._get(effect.value); |
| 1542 this.__data__[effect.value] = value; | 1581 this.__data__[effect.value] = value; |
| 1543 } | 1582 } |
| 1544 var calc = effect.negate ? !value : value; | 1583 this._applyEffectValue(effect, value); |
| 1545 if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) { | |
| 1546 return this._applyEffectValue(effect, calc); | |
| 1547 } | |
| 1548 }, | 1584 }, |
| 1549 _reflectEffect: function (source, value, effect) { | 1585 _reflectEffect: function (source, value, effect) { |
| 1550 this.reflectPropertyToAttribute(source, effect.attribute, value); | 1586 this.reflectPropertyToAttribute(source, effect.attribute, value); |
| 1551 }, | 1587 }, |
| 1552 _notifyEffect: function (source, value, effect, old, fromAbove) { | 1588 _notifyEffect: function (source, value, effect, old, fromAbove) { |
| 1553 if (!fromAbove) { | 1589 if (!fromAbove) { |
| 1554 this._notifyChange(source, effect.event, value); | 1590 this._notifyChange(source, effect.event, value); |
| 1555 } | 1591 } |
| 1556 }, | 1592 }, |
| 1557 _functionEffect: function (source, value, fn, old, fromAbove) { | 1593 _functionEffect: function (source, value, fn, old, fromAbove) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '`
not defined')); | 1626 this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '`
not defined')); |
| 1591 } | 1627 } |
| 1592 }, | 1628 }, |
| 1593 _annotatedComputationEffect: function (source, value, effect) { | 1629 _annotatedComputationEffect: function (source, value, effect) { |
| 1594 var computedHost = this._rootDataHost || this; | 1630 var computedHost = this._rootDataHost || this; |
| 1595 var fn = computedHost[effect.method]; | 1631 var fn = computedHost[effect.method]; |
| 1596 if (fn) { | 1632 if (fn) { |
| 1597 var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value); | 1633 var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value); |
| 1598 if (args) { | 1634 if (args) { |
| 1599 var computedvalue = fn.apply(computedHost, args); | 1635 var computedvalue = fn.apply(computedHost, args); |
| 1600 if (effect.negate) { | |
| 1601 computedvalue = !computedvalue; | |
| 1602 } | |
| 1603 this._applyEffectValue(effect, computedvalue); | 1636 this._applyEffectValue(effect, computedvalue); |
| 1604 } | 1637 } |
| 1605 } else if (effect.dynamicFn) { | 1638 } else if (effect.dynamicFn) { |
| 1606 } else { | 1639 } else { |
| 1607 computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute me
thod `' + effect.method + '` not defined')); | 1640 computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute me
thod `' + effect.method + '` not defined')); |
| 1608 } | 1641 } |
| 1609 }, | 1642 }, |
| 1610 _marshalArgs: function (model, effect, path, value) { | 1643 _marshalArgs: function (model, effect, path, value) { |
| 1611 var values = []; | 1644 var values = []; |
| 1612 var args = effect.args; | 1645 var args = effect.args; |
| 1613 var bailoutEarly = args.length > 1 || effect.dynamicFn; | 1646 var bailoutEarly = args.length > 1 || effect.dynamicFn; |
| 1614 for (var i = 0, l = args.length; i < l; i++) { | 1647 for (var i = 0, l = args.length; i < l; i++) { |
| 1615 var arg = args[i]; | 1648 var arg = args[i]; |
| 1616 var name = arg.name; | 1649 var name = arg.name; |
| 1617 var v; | 1650 var v; |
| 1618 if (arg.literal) { | 1651 if (arg.literal) { |
| 1619 v = arg.value; | 1652 v = arg.value; |
| 1620 } else if (arg.structured) { | 1653 } else if (path === name) { |
| 1621 v = Polymer.Base._get(name, model); | 1654 v = value; |
| 1622 } else { | 1655 } else { |
| 1623 v = model[name]; | 1656 v = model[name]; |
| 1657 if (v === undefined && arg.structured) { |
| 1658 v = Polymer.Base._get(name, model); |
| 1659 } |
| 1624 } | 1660 } |
| 1625 if (bailoutEarly && v === undefined) { | 1661 if (bailoutEarly && v === undefined) { |
| 1626 return; | 1662 return; |
| 1627 } | 1663 } |
| 1628 if (arg.wildcard) { | 1664 if (arg.wildcard) { |
| 1629 var baseChanged = name.indexOf(path + '.') === 0; | 1665 var matches = path.indexOf(name + '.') === 0; |
| 1630 var matches = effect.trigger.name.indexOf(name) === 0 && !baseChanged; | |
| 1631 values[i] = { | 1666 values[i] = { |
| 1632 path: matches ? path : name, | 1667 path: matches ? path : name, |
| 1633 value: matches ? value : v, | 1668 value: matches ? value : v, |
| 1634 base: v | 1669 base: v |
| 1635 }; | 1670 }; |
| 1636 } else { | 1671 } else { |
| 1637 values[i] = v; | 1672 values[i] = v; |
| 1638 } | 1673 } |
| 1639 } | 1674 } |
| 1640 return values; | 1675 return values; |
| 1641 } | 1676 } |
| 1642 }); | 1677 });Polymer.Base._addFeature({ |
| 1643 Polymer.Base._addFeature({ | |
| 1644 _addPropertyEffect: function (property, kind, effect) { | 1678 _addPropertyEffect: function (property, kind, effect) { |
| 1645 var prop = Polymer.Bind.addPropertyEffect(this, property, kind, effect); | 1679 var prop = Polymer.Bind.addPropertyEffect(this, property, kind, effect); |
| 1646 prop.pathFn = this['_' + prop.kind + 'PathEffect']; | 1680 prop.pathFn = this['_' + prop.kind + 'PathEffect']; |
| 1647 }, | 1681 }, |
| 1648 _prepEffects: function () { | 1682 _prepEffects: function () { |
| 1649 Polymer.Bind.prepareModel(this); | 1683 Polymer.Bind.prepareModel(this); |
| 1650 this._addAnnotationEffects(this._notes); | 1684 this._addAnnotationEffects(this._notes); |
| 1651 }, | 1685 }, |
| 1652 _prepBindings: function () { | 1686 _prepBindings: function () { |
| 1653 Polymer.Bind.createBindings(this); | 1687 Polymer.Bind.createBindings(this); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 }, | 1902 }, |
| 1869 _marshalInstanceEffects: function () { | 1903 _marshalInstanceEffects: function () { |
| 1870 Polymer.Bind.prepareInstance(this); | 1904 Polymer.Bind.prepareInstance(this); |
| 1871 if (this._bindListeners) { | 1905 if (this._bindListeners) { |
| 1872 Polymer.Bind.setupBindListeners(this); | 1906 Polymer.Bind.setupBindListeners(this); |
| 1873 } | 1907 } |
| 1874 }, | 1908 }, |
| 1875 _applyEffectValue: function (info, value) { | 1909 _applyEffectValue: function (info, value) { |
| 1876 var node = this._nodes[info.index]; | 1910 var node = this._nodes[info.index]; |
| 1877 var property = info.name; | 1911 var property = info.name; |
| 1912 value = this._computeFinalAnnotationValue(node, property, value, info); |
| 1913 if (info.customEvent && node[property] === value) { |
| 1914 return; |
| 1915 } |
| 1916 if (info.kind == 'attribute') { |
| 1917 this.serializeValueToAttribute(value, property, node); |
| 1918 } else { |
| 1919 var pinfo = node._propertyInfo && node._propertyInfo[property]; |
| 1920 if (pinfo && pinfo.readOnly) { |
| 1921 return; |
| 1922 } |
| 1923 this.__setProperty(property, value, false, node); |
| 1924 } |
| 1925 }, |
| 1926 _computeFinalAnnotationValue: function (node, property, value, info) { |
| 1927 if (info.negate) { |
| 1928 value = !value; |
| 1929 } |
| 1878 if (info.isCompound) { | 1930 if (info.isCompound) { |
| 1879 var storage = node.__compoundStorage__[property]; | 1931 var storage = node.__compoundStorage__[property]; |
| 1880 storage[info.compoundIndex] = value; | 1932 storage[info.compoundIndex] = value; |
| 1881 value = storage.join(''); | 1933 value = storage.join(''); |
| 1882 } | 1934 } |
| 1883 if (info.kind == 'attribute') { | 1935 if (info.kind !== 'attribute') { |
| 1884 this.serializeValueToAttribute(value, property, node); | |
| 1885 } else { | |
| 1886 if (property === 'className') { | 1936 if (property === 'className') { |
| 1887 value = this._scopeElementClass(node, value); | 1937 value = this._scopeElementClass(node, value); |
| 1888 } | 1938 } |
| 1889 if (property === 'textContent' || node.localName == 'input' && property == 'valu
e') { | 1939 if (property === 'textContent' || node.localName == 'input' && property == 'valu
e') { |
| 1890 value = value == undefined ? '' : value; | 1940 value = value == undefined ? '' : value; |
| 1891 } | 1941 } |
| 1892 var pinfo; | |
| 1893 if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) || !pinfo.rea
dOnly) { | |
| 1894 this.__setProperty(property, value, false, node); | |
| 1895 } | 1942 } |
| 1896 } | 1943 return value; |
| 1897 }, | 1944 }, |
| 1898 _executeStaticEffects: function () { | 1945 _executeStaticEffects: function () { |
| 1899 if (this._propertyEffects && this._propertyEffects.__static__) { | 1946 if (this._propertyEffects && this._propertyEffects.__static__) { |
| 1900 this._effectEffects('__static__', null, this._propertyEffects.__static__); | 1947 this._effectEffects('__static__', null, this._propertyEffects.__static__); |
| 1901 } | 1948 } |
| 1902 } | 1949 } |
| 1903 }); | 1950 });(function () { |
| 1904 (function () { | |
| 1905 var usePolyfillProto = Polymer.Settings.usePolyfillProto; | 1951 var usePolyfillProto = Polymer.Settings.usePolyfillProto; |
| 1906 Polymer.Base._addFeature({ | 1952 Polymer.Base._addFeature({ |
| 1907 _setupConfigure: function (initialConfig) { | 1953 _setupConfigure: function (initialConfig) { |
| 1908 this._config = {}; | 1954 this._config = {}; |
| 1909 this._handlers = []; | 1955 this._handlers = []; |
| 1910 this._aboveConfig = null; | 1956 this._aboveConfig = null; |
| 1911 if (initialConfig) { | 1957 if (initialConfig) { |
| 1912 for (var i in initialConfig) { | 1958 for (var i in initialConfig) { |
| 1913 if (initialConfig[i] !== undefined) { | 1959 if (initialConfig[i] !== undefined) { |
| 1914 this._config[i] = initialConfig[i]; | 1960 this._config[i] = initialConfig[i]; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 } | 2007 } |
| 1962 } | 2008 } |
| 1963 }, | 2009 }, |
| 1964 _distributeConfig: function (config) { | 2010 _distributeConfig: function (config) { |
| 1965 var fx$ = this._propertyEffects; | 2011 var fx$ = this._propertyEffects; |
| 1966 if (fx$) { | 2012 if (fx$) { |
| 1967 for (var p in config) { | 2013 for (var p in config) { |
| 1968 var fx = fx$[p]; | 2014 var fx = fx$[p]; |
| 1969 if (fx) { | 2015 if (fx) { |
| 1970 for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) { | 2016 for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) { |
| 1971 if (x.kind === 'annotation' && !x.isCompound) { | 2017 if (x.kind === 'annotation') { |
| 1972 var node = this._nodes[x.effect.index]; | 2018 var node = this._nodes[x.effect.index]; |
| 1973 var name = x.effect.propertyName; | 2019 var name = x.effect.propertyName; |
| 1974 var isAttr = x.effect.kind == 'attribute'; | 2020 var isAttr = x.effect.kind == 'attribute'; |
| 1975 var hasEffect = node._propertyEffects && node._propertyEffects[name]; | 2021 var hasEffect = node._propertyEffects && node._propertyEffects[name]; |
| 1976 if (node._configValue && (hasEffect || !isAttr)) { | 2022 if (node._configValue && (hasEffect || !isAttr)) { |
| 1977 var value = p === x.effect.value ? config[p] : this._get(x.effect.value, config)
; | 2023 var value = p === x.effect.value ? config[p] : this._get(x.effect.value, config)
; |
| 2024 value = this._computeFinalAnnotationValue(node, name, value, x.effect); |
| 1978 if (isAttr) { | 2025 if (isAttr) { |
| 1979 value = node.deserialize(this.serialize(value), node._propertyInfo[name].type); | 2026 value = node.deserialize(this.serialize(value), node._propertyInfo[name].type); |
| 1980 } | 2027 } |
| 1981 node._configValue(name, value); | 2028 node._configValue(name, value); |
| 1982 } | 2029 } |
| 1983 } | 2030 } |
| 1984 } | 2031 } |
| 1985 } | 2032 } |
| 1986 } | 2033 } |
| 1987 } | 2034 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 this._handlers.push(args); | 2068 this._handlers.push(args); |
| 2022 }, | 2069 }, |
| 2023 _flushHandlers: function () { | 2070 _flushHandlers: function () { |
| 2024 var h$ = this._handlers; | 2071 var h$ = this._handlers; |
| 2025 for (var i = 0, l = h$.length, h; i < l && (h = h$[i]); i++) { | 2072 for (var i = 0, l = h$.length, h; i < l && (h = h$[i]); i++) { |
| 2026 h[0].call(this, h[1], h[2], h[3]); | 2073 h[0].call(this, h[1], h[2], h[3]); |
| 2027 } | 2074 } |
| 2028 this._handlers = []; | 2075 this._handlers = []; |
| 2029 } | 2076 } |
| 2030 }); | 2077 }); |
| 2031 }()); | 2078 }());(function () { |
| 2032 (function () { | |
| 2033 'use strict'; | 2079 'use strict'; |
| 2034 Polymer.Base._addFeature({ | 2080 Polymer.Base._addFeature({ |
| 2035 notifyPath: function (path, value, fromAbove) { | 2081 notifyPath: function (path, value, fromAbove) { |
| 2036 var info = {}; | 2082 var info = {}; |
| 2037 this._get(path, this, info); | 2083 var v = this._get(path, this, info); |
| 2084 if (arguments.length === 1) { |
| 2085 value = v; |
| 2086 } |
| 2038 if (info.path) { | 2087 if (info.path) { |
| 2039 this._notifyPath(info.path, value, fromAbove); | 2088 this._notifyPath(info.path, value, fromAbove); |
| 2040 } | 2089 } |
| 2041 }, | 2090 }, |
| 2042 _notifyPath: function (path, value, fromAbove) { | 2091 _notifyPath: function (path, value, fromAbove) { |
| 2043 var old = this._propertySetter(path, value); | 2092 var old = this._propertySetter(path, value); |
| 2044 if (old !== value && (old === old || value === value)) { | 2093 if (old !== value && (old === old || value === value)) { |
| 2045 this._pathEffector(path, value); | 2094 this._pathEffector(path, value); |
| 2046 if (!fromAbove) { | 2095 if (!fromAbove) { |
| 2047 this._notifyPathUp(path, value); | 2096 this._notifyPathUp(path, value); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 Polymer.Bind._computeEffect.call(this, path, value, effect); | 2219 Polymer.Bind._computeEffect.call(this, path, value, effect); |
| 2171 } | 2220 } |
| 2172 }, | 2221 }, |
| 2173 _annotatedComputationPathEffect: function (path, value, effect) { | 2222 _annotatedComputationPathEffect: function (path, value, effect) { |
| 2174 if (this._pathMatchesEffect(path, effect)) { | 2223 if (this._pathMatchesEffect(path, effect)) { |
| 2175 Polymer.Bind._annotatedComputationEffect.call(this, path, value, effect); | 2224 Polymer.Bind._annotatedComputationEffect.call(this, path, value, effect); |
| 2176 } | 2225 } |
| 2177 }, | 2226 }, |
| 2178 _pathMatchesEffect: function (path, effect) { | 2227 _pathMatchesEffect: function (path, effect) { |
| 2179 var effectArg = effect.trigger.name; | 2228 var effectArg = effect.trigger.name; |
| 2180 return effectArg == path || effectArg.indexOf(path + '.') === 0 || effect.trigge
r.wildcard && path.indexOf(effectArg) === 0; | 2229 return effectArg == path || effectArg.indexOf(path + '.') === 0 || effect.trigge
r.wildcard && path.indexOf(effectArg + '.') === 0; |
| 2181 }, | 2230 }, |
| 2182 linkPaths: function (to, from) { | 2231 linkPaths: function (to, from) { |
| 2183 this._boundPaths = this._boundPaths || {}; | 2232 this._boundPaths = this._boundPaths || {}; |
| 2184 if (from) { | 2233 if (from) { |
| 2185 this._boundPaths[to] = from; | 2234 this._boundPaths[to] = from; |
| 2186 } else { | 2235 } else { |
| 2187 this.unlinkPaths(to); | 2236 this.unlinkPaths(to); |
| 2188 } | 2237 } |
| 2189 }, | 2238 }, |
| 2190 unlinkPaths: function (path) { | 2239 unlinkPaths: function (path) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 notifySplices: function (path, splices) { | 2274 notifySplices: function (path, splices) { |
| 2226 var info = {}; | 2275 var info = {}; |
| 2227 var array = this._get(path, this, info); | 2276 var array = this._get(path, this, info); |
| 2228 this._notifySplices(array, info.path, splices); | 2277 this._notifySplices(array, info.path, splices); |
| 2229 }, | 2278 }, |
| 2230 _notifySplices: function (array, path, splices) { | 2279 _notifySplices: function (array, path, splices) { |
| 2231 var change = { | 2280 var change = { |
| 2232 keySplices: Polymer.Collection.applySplices(array, splices), | 2281 keySplices: Polymer.Collection.applySplices(array, splices), |
| 2233 indexSplices: splices | 2282 indexSplices: splices |
| 2234 }; | 2283 }; |
| 2235 if (!array.hasOwnProperty('splices')) { | 2284 var splicesPath = path + '.splices'; |
| 2236 Object.defineProperty(array, 'splices', { | 2285 this._notifyPath(splicesPath, change); |
| 2237 configurable: true, | |
| 2238 writable: true | |
| 2239 }); | |
| 2240 } | |
| 2241 array.splices = change; | |
| 2242 this._notifyPath(path + '.splices', change); | |
| 2243 this._notifyPath(path + '.length', array.length); | 2286 this._notifyPath(path + '.length', array.length); |
| 2244 change.keySplices = null; | 2287 this.__data__[splicesPath] = { |
| 2245 change.indexSplices = null; | 2288 keySplices: null, |
| 2289 indexSplices: null |
| 2290 }; |
| 2246 }, | 2291 }, |
| 2247 _notifySplice: function (array, path, index, added, removed) { | 2292 _notifySplice: function (array, path, index, added, removed) { |
| 2248 this._notifySplices(array, path, [{ | 2293 this._notifySplices(array, path, [{ |
| 2249 index: index, | 2294 index: index, |
| 2250 addedCount: added, | 2295 addedCount: added, |
| 2251 removed: removed, | 2296 removed: removed, |
| 2252 object: array, | 2297 object: array, |
| 2253 type: 'splice' | 2298 type: 'splice' |
| 2254 }]); | 2299 }]); |
| 2255 }, | 2300 }, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2330 _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect, | 2375 _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect, |
| 2331 _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect, | 2376 _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect, |
| 2332 _computePathEffect: Polymer.Base._computePathEffect, | 2377 _computePathEffect: Polymer.Base._computePathEffect, |
| 2333 _modelForPath: Polymer.Base._modelForPath, | 2378 _modelForPath: Polymer.Base._modelForPath, |
| 2334 _pathMatchesEffect: Polymer.Base._pathMatchesEffect, | 2379 _pathMatchesEffect: Polymer.Base._pathMatchesEffect, |
| 2335 _notifyBoundPaths: Polymer.Base._notifyBoundPaths, | 2380 _notifyBoundPaths: Polymer.Base._notifyBoundPaths, |
| 2336 _getPathParts: Polymer.Base._getPathParts | 2381 _getPathParts: Polymer.Base._getPathParts |
| 2337 }); | 2382 }); |
| 2338 } | 2383 } |
| 2339 }); | 2384 }); |
| 2340 }()); | 2385 }());Polymer.Base._addFeature({ |
| 2341 Polymer.Base._addFeature({ | |
| 2342 resolveUrl: function (url) { | 2386 resolveUrl: function (url) { |
| 2343 var module = Polymer.DomModule.import(this.is); | 2387 var module = Polymer.DomModule.import(this.is); |
| 2344 var root = ''; | 2388 var root = ''; |
| 2345 if (module) { | 2389 if (module) { |
| 2346 var assetPath = module.getAttribute('assetpath') || ''; | 2390 var assetPath = module.getAttribute('assetpath') || ''; |
| 2347 root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI); | 2391 root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI); |
| 2348 } | 2392 } |
| 2349 return Polymer.ResolveUrl.resolveUrl(url, root); | 2393 return Polymer.ResolveUrl.resolveUrl(url, root); |
| 2350 } | 2394 } |
| 2351 }); | 2395 });Polymer.CssParse = function () { |
| 2352 Polymer.CssParse = function () { | |
| 2353 return { | 2396 return { |
| 2354 parse: function (text) { | 2397 parse: function (text) { |
| 2355 text = this._clean(text); | 2398 text = this._clean(text); |
| 2356 return this._parseCss(this._lex(text), text); | 2399 return this._parseCss(this._lex(text), text); |
| 2357 }, | 2400 }, |
| 2358 _clean: function (cssText) { | 2401 _clean: function (cssText) { |
| 2359 return cssText.replace(this._rx.comments, '').replace(this._rx.port, ''); | 2402 return cssText.replace(this._rx.comments, '').replace(this._rx.port, ''); |
| 2360 }, | 2403 }, |
| 2361 _lex: function (text) { | 2404 _lex: function (text) { |
| 2362 var root = { | 2405 var root = { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 code = '0' + code; | 2471 code = '0' + code; |
| 2429 } | 2472 } |
| 2430 return '\\' + code; | 2473 return '\\' + code; |
| 2431 }); | 2474 }); |
| 2432 }, | 2475 }, |
| 2433 stringify: function (node, preserveProperties, text) { | 2476 stringify: function (node, preserveProperties, text) { |
| 2434 text = text || ''; | 2477 text = text || ''; |
| 2435 var cssText = ''; | 2478 var cssText = ''; |
| 2436 if (node.cssText || node.rules) { | 2479 if (node.cssText || node.rules) { |
| 2437 var r$ = node.rules; | 2480 var r$ = node.rules; |
| 2438 if (r$ && (preserveProperties || !this._hasMixinRules(r$))) { | 2481 if (r$ && !this._hasMixinRules(r$)) { |
| 2439 for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) { | 2482 for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) { |
| 2440 cssText = this.stringify(r, preserveProperties, cssText); | 2483 cssText = this.stringify(r, preserveProperties, cssText); |
| 2441 } | 2484 } |
| 2442 } else { | 2485 } else { |
| 2443 cssText = preserveProperties ? node.cssText : this.removeCustomProps(node.cssTex
t); | 2486 cssText = preserveProperties ? node.cssText : this.removeCustomProps(node.cssTex
t); |
| 2444 cssText = cssText.trim(); | 2487 cssText = cssText.trim(); |
| 2445 if (cssText) { | 2488 if (cssText) { |
| 2446 cssText = ' ' + cssText + '\n'; | 2489 cssText = ' ' + cssText + '\n'; |
| 2447 } | 2490 } |
| 2448 } | 2491 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2477 MEDIA_RULE: 4, | 2520 MEDIA_RULE: 4, |
| 2478 MIXIN_RULE: 1000 | 2521 MIXIN_RULE: 1000 |
| 2479 }, | 2522 }, |
| 2480 OPEN_BRACE: '{', | 2523 OPEN_BRACE: '{', |
| 2481 CLOSE_BRACE: '}', | 2524 CLOSE_BRACE: '}', |
| 2482 _rx: { | 2525 _rx: { |
| 2483 comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim, | 2526 comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim, |
| 2484 port: /@import[^;]*;/gim, | 2527 port: /@import[^;]*;/gim, |
| 2485 customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim, | 2528 customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim, |
| 2486 mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim, | 2529 mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim, |
| 2487 mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim, | 2530 mixinApply: /@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim, |
| 2488 varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim, | 2531 varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim, |
| 2489 keyframesRule: /^@[^\s]*keyframes/, | 2532 keyframesRule: /^@[^\s]*keyframes/, |
| 2490 multipleSpaces: /\s+/g | 2533 multipleSpaces: /\s+/g |
| 2491 }, | 2534 }, |
| 2492 VAR_START: '--', | 2535 VAR_START: '--', |
| 2493 MEDIA_START: '@media', | 2536 MEDIA_START: '@media', |
| 2494 AT_START: '@' | 2537 AT_START: '@' |
| 2495 }; | 2538 }; |
| 2496 }(); | 2539 }();Polymer.StyleUtil = function () { |
| 2497 Polymer.StyleUtil = function () { | 2540 var settings = Polymer.Settings; |
| 2498 return { | 2541 return { |
| 2542 NATIVE_VARIABLES: Polymer.Settings.useNativeCSSProperties, |
| 2499 MODULE_STYLES_SELECTOR: 'style, link[rel=import][type~=css], template', | 2543 MODULE_STYLES_SELECTOR: 'style, link[rel=import][type~=css], template', |
| 2500 INCLUDE_ATTR: 'include', | 2544 INCLUDE_ATTR: 'include', |
| 2501 toCssText: function (rules, callback, preserveProperties) { | 2545 toCssText: function (rules, callback) { |
| 2502 if (typeof rules === 'string') { | 2546 if (typeof rules === 'string') { |
| 2503 rules = this.parser.parse(rules); | 2547 rules = this.parser.parse(rules); |
| 2504 } | 2548 } |
| 2505 if (callback) { | 2549 if (callback) { |
| 2506 this.forEachRule(rules, callback); | 2550 this.forEachRule(rules, callback); |
| 2507 } | 2551 } |
| 2508 return this.parser.stringify(rules, preserveProperties); | 2552 return this.parser.stringify(rules, this.NATIVE_VARIABLES); |
| 2509 }, | 2553 }, |
| 2510 forRulesInStyles: function (styles, styleRuleCallback, keyframesRuleCallback) { | 2554 forRulesInStyles: function (styles, styleRuleCallback, keyframesRuleCallback) { |
| 2511 if (styles) { | 2555 if (styles) { |
| 2512 for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) { | 2556 for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) { |
| 2513 this.forEachRule(this.rulesForStyle(s), styleRuleCallback, keyframesRuleCallback
); | 2557 this.forEachRuleInStyle(s, styleRuleCallback, keyframesRuleCallback); |
| 2514 } | 2558 } |
| 2515 } | 2559 } |
| 2516 }, | 2560 }, |
| 2561 forActiveRulesInStyles: function (styles, styleRuleCallback, keyframesRuleCallba
ck) { |
| 2562 if (styles) { |
| 2563 for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) { |
| 2564 this.forEachRuleInStyle(s, styleRuleCallback, keyframesRuleCallback, true); |
| 2565 } |
| 2566 } |
| 2567 }, |
| 2517 rulesForStyle: function (style) { | 2568 rulesForStyle: function (style) { |
| 2518 if (!style.__cssRules && style.textContent) { | 2569 if (!style.__cssRules && style.textContent) { |
| 2519 style.__cssRules = this.parser.parse(style.textContent); | 2570 style.__cssRules = this.parser.parse(style.textContent); |
| 2520 } | 2571 } |
| 2521 return style.__cssRules; | 2572 return style.__cssRules; |
| 2522 }, | 2573 }, |
| 2523 isKeyframesSelector: function (rule) { | 2574 isKeyframesSelector: function (rule) { |
| 2524 return rule.parent && rule.parent.type === this.ruleTypes.KEYFRAMES_RULE; | 2575 return rule.parent && rule.parent.type === this.ruleTypes.KEYFRAMES_RULE; |
| 2525 }, | 2576 }, |
| 2526 forEachRule: function (node, styleRuleCallback, keyframesRuleCallback) { | 2577 forEachRuleInStyle: function (style, styleRuleCallback, keyframesRuleCallback, o
nlyActiveRules) { |
| 2578 var rules = this.rulesForStyle(style); |
| 2579 var styleCallback, keyframeCallback; |
| 2580 if (styleRuleCallback) { |
| 2581 styleCallback = function (rule) { |
| 2582 styleRuleCallback(rule, style); |
| 2583 }; |
| 2584 } |
| 2585 if (keyframesRuleCallback) { |
| 2586 keyframeCallback = function (rule) { |
| 2587 keyframesRuleCallback(rule, style); |
| 2588 }; |
| 2589 } |
| 2590 this.forEachRule(rules, styleCallback, keyframeCallback, onlyActiveRules); |
| 2591 }, |
| 2592 forEachRule: function (node, styleRuleCallback, keyframesRuleCallback, onlyActiv
eRules) { |
| 2527 if (!node) { | 2593 if (!node) { |
| 2528 return; | 2594 return; |
| 2529 } | 2595 } |
| 2530 var skipRules = false; | 2596 var skipRules = false; |
| 2597 if (onlyActiveRules) { |
| 2598 if (node.type === this.ruleTypes.MEDIA_RULE) { |
| 2599 var matchMedia = node.selector.match(this.rx.MEDIA_MATCH); |
| 2600 if (matchMedia) { |
| 2601 if (!window.matchMedia(matchMedia[1]).matches) { |
| 2602 skipRules = true; |
| 2603 } |
| 2604 } |
| 2605 } |
| 2606 } |
| 2531 if (node.type === this.ruleTypes.STYLE_RULE) { | 2607 if (node.type === this.ruleTypes.STYLE_RULE) { |
| 2532 styleRuleCallback(node); | 2608 styleRuleCallback(node); |
| 2533 } else if (keyframesRuleCallback && node.type === this.ruleTypes.KEYFRAMES_RULE)
{ | 2609 } else if (keyframesRuleCallback && node.type === this.ruleTypes.KEYFRAMES_RULE)
{ |
| 2534 keyframesRuleCallback(node); | 2610 keyframesRuleCallback(node); |
| 2535 } else if (node.type === this.ruleTypes.MIXIN_RULE) { | 2611 } else if (node.type === this.ruleTypes.MIXIN_RULE) { |
| 2536 skipRules = true; | 2612 skipRules = true; |
| 2537 } | 2613 } |
| 2538 var r$ = node.rules; | 2614 var r$ = node.rules; |
| 2539 if (r$ && !skipRules) { | 2615 if (r$ && !skipRules) { |
| 2540 for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) { | 2616 for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) { |
| 2541 this.forEachRule(r, styleRuleCallback, keyframesRuleCallback); | 2617 this.forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules); |
| 2542 } | 2618 } |
| 2543 } | 2619 } |
| 2544 }, | 2620 }, |
| 2545 applyCss: function (cssText, moniker, target, contextNode) { | 2621 applyCss: function (cssText, moniker, target, contextNode) { |
| 2546 var style = this.createScopeStyle(cssText, moniker); | 2622 var style = this.createScopeStyle(cssText, moniker); |
| 2623 return this.applyStyle(style, target, contextNode); |
| 2624 }, |
| 2625 applyStyle: function (style, target, contextNode) { |
| 2547 target = target || document.head; | 2626 target = target || document.head; |
| 2548 var after = contextNode && contextNode.nextSibling || target.firstChild; | 2627 var after = contextNode && contextNode.nextSibling || target.firstChild; |
| 2549 this.__lastHeadApplyNode = style; | 2628 this.__lastHeadApplyNode = style; |
| 2550 return target.insertBefore(style, after); | 2629 return target.insertBefore(style, after); |
| 2551 }, | 2630 }, |
| 2552 createScopeStyle: function (cssText, moniker) { | 2631 createScopeStyle: function (cssText, moniker) { |
| 2553 var style = document.createElement('style'); | 2632 var style = document.createElement('style'); |
| 2554 if (moniker) { | 2633 if (moniker) { |
| 2555 style.setAttribute('scope', moniker); | 2634 style.setAttribute('scope', moniker); |
| 2556 } | 2635 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 e = e.__appliedElement || e; | 2680 e = e.__appliedElement || e; |
| 2602 e.parentNode.removeChild(e); | 2681 e.parentNode.removeChild(e); |
| 2603 cssText += this.resolveCss(e.textContent, element.ownerDocument); | 2682 cssText += this.resolveCss(e.textContent, element.ownerDocument); |
| 2604 } else if (e.import && e.import.body) { | 2683 } else if (e.import && e.import.body) { |
| 2605 cssText += this.resolveCss(e.import.body.textContent, e.import); | 2684 cssText += this.resolveCss(e.import.body.textContent, e.import); |
| 2606 } | 2685 } |
| 2607 } | 2686 } |
| 2608 } | 2687 } |
| 2609 return cssText; | 2688 return cssText; |
| 2610 }, | 2689 }, |
| 2690 isTargetedBuild: function (buildType) { |
| 2691 return settings.useNativeShadow ? buildType === 'shadow' : buildType === 'shady'
; |
| 2692 }, |
| 2693 cssBuildTypeForModule: function (module) { |
| 2694 var dm = Polymer.DomModule.import(module); |
| 2695 if (dm) { |
| 2696 return this.getCssBuildType(dm); |
| 2697 } |
| 2698 }, |
| 2699 getCssBuildType: function (element) { |
| 2700 return element.getAttribute('css-build'); |
| 2701 }, |
| 2702 rx: { |
| 2703 VAR_ASSIGN: /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}]
)|$)/gi, |
| 2704 MIXIN_MATCH: /(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi, |
| 2705 VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,()]*)|(?:[^;()]*\([^;)]*
\)+))[\s]*?\)/gi, |
| 2706 VAR_CONSUMED: /(--[\w-]+)\s*([:,;)]|$)/gi, |
| 2707 ANIMATION_MATCH: /(animation\s*:)|(animation-name\s*:)/, |
| 2708 MEDIA_MATCH: /@media[^(]*(\([^)]*\))/, |
| 2709 IS_VAR: /^--/, |
| 2710 BRACKETED: /\{[^}]*\}/g, |
| 2711 HOST_PREFIX: '(?:^|[^.#[:])', |
| 2712 HOST_SUFFIX: '($|[.:[\\s>+~])' |
| 2713 }, |
| 2611 resolveCss: Polymer.ResolveUrl.resolveCss, | 2714 resolveCss: Polymer.ResolveUrl.resolveCss, |
| 2612 parser: Polymer.CssParse, | 2715 parser: Polymer.CssParse, |
| 2613 ruleTypes: Polymer.CssParse.types | 2716 ruleTypes: Polymer.CssParse.types |
| 2614 }; | 2717 }; |
| 2615 }(); | 2718 }();Polymer.StyleTransformer = function () { |
| 2616 Polymer.StyleTransformer = function () { | |
| 2617 var nativeShadow = Polymer.Settings.useNativeShadow; | |
| 2618 var styleUtil = Polymer.StyleUtil; | 2719 var styleUtil = Polymer.StyleUtil; |
| 2720 var settings = Polymer.Settings; |
| 2619 var api = { | 2721 var api = { |
| 2620 dom: function (node, scope, useAttr, shouldRemoveScope) { | 2722 dom: function (node, scope, useAttr, shouldRemoveScope) { |
| 2621 this._transformDom(node, scope || '', useAttr, shouldRemoveScope); | 2723 this._transformDom(node, scope || '', useAttr, shouldRemoveScope); |
| 2622 }, | 2724 }, |
| 2623 _transformDom: function (node, selector, useAttr, shouldRemoveScope) { | 2725 _transformDom: function (node, selector, useAttr, shouldRemoveScope) { |
| 2624 if (node.setAttribute) { | 2726 if (node.setAttribute) { |
| 2625 this.element(node, selector, useAttr, shouldRemoveScope); | 2727 this.element(node, selector, useAttr, shouldRemoveScope); |
| 2626 } | 2728 } |
| 2627 var c$ = Polymer.dom(node).childNodes; | 2729 var c$ = Polymer.dom(node).childNodes; |
| 2628 for (var i = 0; i < c$.length; i++) { | 2730 for (var i = 0; i < c$.length; i++) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2655 } else { | 2757 } else { |
| 2656 element.setAttribute(CLASS, (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope); | 2758 element.setAttribute(CLASS, (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope); |
| 2657 } | 2759 } |
| 2658 } | 2760 } |
| 2659 } | 2761 } |
| 2660 } | 2762 } |
| 2661 }, | 2763 }, |
| 2662 elementStyles: function (element, callback) { | 2764 elementStyles: function (element, callback) { |
| 2663 var styles = element._styles; | 2765 var styles = element._styles; |
| 2664 var cssText = ''; | 2766 var cssText = ''; |
| 2767 var cssBuildType = element.__cssBuild; |
| 2665 for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) { | 2768 for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) { |
| 2666 var rules = styleUtil.rulesForStyle(s); | 2769 var rules = styleUtil.rulesForStyle(s); |
| 2667 cssText += nativeShadow ? styleUtil.toCssText(rules, callback) : this.css(rules,
element.is, element.extends, callback, element._scopeCssViaAttr) + '\n\n'; | 2770 cssText += settings.useNativeShadow || cssBuildType === 'shady' ? styleUtil.toCs
sText(rules, callback) : this.css(rules, element.is, element.extends, callback,
element._scopeCssViaAttr) + '\n\n'; |
| 2668 } | 2771 } |
| 2669 return cssText.trim(); | 2772 return cssText.trim(); |
| 2670 }, | 2773 }, |
| 2671 css: function (rules, scope, ext, callback, useAttr) { | 2774 css: function (rules, scope, ext, callback, useAttr) { |
| 2672 var hostScope = this._calcHostScope(scope, ext); | 2775 var hostScope = this._calcHostScope(scope, ext); |
| 2673 scope = this._calcElementScope(scope, useAttr); | 2776 scope = this._calcElementScope(scope, useAttr); |
| 2674 var self = this; | 2777 var self = this; |
| 2675 return styleUtil.toCssText(rules, function (rule) { | 2778 return styleUtil.toCssText(rules, function (rule) { |
| 2676 if (!rule.isScoped) { | 2779 if (!rule.isScoped) { |
| 2677 self.rule(rule, scope, hostScope); | 2780 self.rule(rule, scope, hostScope); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2689 return ''; | 2792 return ''; |
| 2690 } | 2793 } |
| 2691 }, | 2794 }, |
| 2692 _calcHostScope: function (scope, ext) { | 2795 _calcHostScope: function (scope, ext) { |
| 2693 return ext ? '[is=' + scope + ']' : scope; | 2796 return ext ? '[is=' + scope + ']' : scope; |
| 2694 }, | 2797 }, |
| 2695 rule: function (rule, scope, hostScope) { | 2798 rule: function (rule, scope, hostScope) { |
| 2696 this._transformRule(rule, this._transformComplexSelector, scope, hostScope); | 2799 this._transformRule(rule, this._transformComplexSelector, scope, hostScope); |
| 2697 }, | 2800 }, |
| 2698 _transformRule: function (rule, transformer, scope, hostScope) { | 2801 _transformRule: function (rule, transformer, scope, hostScope) { |
| 2802 rule.selector = rule.transformedSelector = this._transformRuleCss(rule, transfor
mer, scope, hostScope); |
| 2803 }, |
| 2804 _transformRuleCss: function (rule, transformer, scope, hostScope) { |
| 2699 var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP); | 2805 var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP); |
| 2700 if (!styleUtil.isKeyframesSelector(rule)) { | 2806 if (!styleUtil.isKeyframesSelector(rule)) { |
| 2701 for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) { | 2807 for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) { |
| 2702 p$[i] = transformer.call(this, p, scope, hostScope); | 2808 p$[i] = transformer.call(this, p, scope, hostScope); |
| 2703 } | 2809 } |
| 2704 } | 2810 } |
| 2705 rule.selector = rule.transformedSelector = p$.join(COMPLEX_SELECTOR_SEP); | 2811 return p$.join(COMPLEX_SELECTOR_SEP); |
| 2706 }, | 2812 }, |
| 2707 _transformComplexSelector: function (selector, scope, hostScope) { | 2813 _transformComplexSelector: function (selector, scope, hostScope) { |
| 2708 var stop = false; | 2814 var stop = false; |
| 2709 var hostContext = false; | 2815 var hostContext = false; |
| 2710 var self = this; | 2816 var self = this; |
| 2817 selector = selector.trim(); |
| 2711 selector = selector.replace(CONTENT_START, HOST + ' $1'); | 2818 selector = selector.replace(CONTENT_START, HOST + ' $1'); |
| 2712 selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) { | 2819 selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) { |
| 2713 if (!stop) { | 2820 if (!stop) { |
| 2714 var info = self._transformCompoundSelector(s, c, scope, hostScope); | 2821 var info = self._transformCompoundSelector(s, c, scope, hostScope); |
| 2715 stop = stop || info.stop; | 2822 stop = stop || info.stop; |
| 2716 hostContext = hostContext || info.hostContext; | 2823 hostContext = hostContext || info.hostContext; |
| 2717 c = info.combinator; | 2824 c = info.combinator; |
| 2718 s = info.value; | 2825 s = info.value; |
| 2719 } else { | 2826 } else { |
| 2720 s = s.replace(SCOPE_JUMP, ' '); | 2827 s = s.replace(SCOPE_JUMP, ' '); |
| 2721 } | 2828 } |
| 2722 return c + s; | 2829 return c + s; |
| 2723 }); | 2830 }); |
| 2724 if (hostContext) { | 2831 if (hostContext) { |
| 2725 selector = selector.replace(HOST_CONTEXT_PAREN, function (m, pre, paren, post) { | 2832 selector = selector.replace(HOST_CONTEXT_PAREN, function (m, pre, paren, post) { |
| 2726 return pre + paren + ' ' + hostScope + post + COMPLEX_SELECTOR_SEP + ' ' + pre +
hostScope + paren + post; | 2833 return pre + paren + ' ' + hostScope + post + COMPLEX_SELECTOR_SEP + ' ' + pre +
hostScope + paren + post; |
| 2727 }); | 2834 }); |
| 2728 } | 2835 } |
| 2729 return selector; | 2836 return selector; |
| 2730 }, | 2837 }, |
| 2731 _transformCompoundSelector: function (selector, combinator, scope, hostScope) { | 2838 _transformCompoundSelector: function (selector, combinator, scope, hostScope) { |
| 2732 var jumpIndex = selector.search(SCOPE_JUMP); | 2839 var jumpIndex = selector.search(SCOPE_JUMP); |
| 2733 var hostContext = false; | 2840 var hostContext = false; |
| 2734 if (selector.indexOf(HOST_CONTEXT) >= 0) { | 2841 if (selector.indexOf(HOST_CONTEXT) >= 0) { |
| 2735 hostContext = true; | 2842 hostContext = true; |
| 2736 } else if (selector.indexOf(HOST) >= 0) { | 2843 } else if (selector.indexOf(HOST) >= 0) { |
| 2737 selector = selector.replace(HOST_PAREN, function (m, host, paren) { | 2844 selector = this._transformHostSelector(selector, hostScope); |
| 2738 return hostScope + paren; | |
| 2739 }); | |
| 2740 selector = selector.replace(HOST, hostScope); | |
| 2741 } else if (jumpIndex !== 0) { | 2845 } else if (jumpIndex !== 0) { |
| 2742 selector = scope ? this._transformSimpleSelector(selector, scope) : selector; | 2846 selector = scope ? this._transformSimpleSelector(selector, scope) : selector; |
| 2743 } | 2847 } |
| 2744 if (selector.indexOf(CONTENT) >= 0) { | 2848 if (selector.indexOf(CONTENT) >= 0) { |
| 2745 combinator = ''; | 2849 combinator = ''; |
| 2746 } | 2850 } |
| 2747 var stop; | 2851 var stop; |
| 2748 if (jumpIndex >= 0) { | 2852 if (jumpIndex >= 0) { |
| 2749 selector = selector.replace(SCOPE_JUMP, ' '); | 2853 selector = selector.replace(SCOPE_JUMP, ' '); |
| 2750 stop = true; | 2854 stop = true; |
| 2751 } | 2855 } |
| 2752 return { | 2856 return { |
| 2753 value: selector, | 2857 value: selector, |
| 2754 combinator: combinator, | 2858 combinator: combinator, |
| 2755 stop: stop, | 2859 stop: stop, |
| 2756 hostContext: hostContext | 2860 hostContext: hostContext |
| 2757 }; | 2861 }; |
| 2758 }, | 2862 }, |
| 2759 _transformSimpleSelector: function (selector, scope) { | 2863 _transformSimpleSelector: function (selector, scope) { |
| 2760 var p$ = selector.split(PSEUDO_PREFIX); | 2864 var p$ = selector.split(PSEUDO_PREFIX); |
| 2761 p$[0] += scope; | 2865 p$[0] += scope; |
| 2762 return p$.join(PSEUDO_PREFIX); | 2866 return p$.join(PSEUDO_PREFIX); |
| 2763 }, | 2867 }, |
| 2868 _transformHostSelector: function (selector, hostScope) { |
| 2869 var m = selector.match(HOST_PAREN); |
| 2870 var paren = m && m[2].trim() || ''; |
| 2871 if (paren) { |
| 2872 if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) { |
| 2873 var typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0]; |
| 2874 if (typeSelector === hostScope) { |
| 2875 return paren; |
| 2876 } else { |
| 2877 return SELECTOR_NO_MATCH; |
| 2878 } |
| 2879 } else { |
| 2880 return selector.replace(HOST_PAREN, function (m, host, paren) { |
| 2881 return hostScope + paren; |
| 2882 }); |
| 2883 } |
| 2884 } else { |
| 2885 return selector.replace(HOST, hostScope); |
| 2886 } |
| 2887 }, |
| 2764 documentRule: function (rule) { | 2888 documentRule: function (rule) { |
| 2765 rule.selector = rule.parsedSelector; | 2889 rule.selector = rule.parsedSelector; |
| 2766 this.normalizeRootSelector(rule); | 2890 this.normalizeRootSelector(rule); |
| 2767 if (!nativeShadow) { | 2891 if (!settings.useNativeShadow) { |
| 2768 this._transformRule(rule, this._transformDocumentSelector); | 2892 this._transformRule(rule, this._transformDocumentSelector); |
| 2769 } | 2893 } |
| 2770 }, | 2894 }, |
| 2771 normalizeRootSelector: function (rule) { | 2895 normalizeRootSelector: function (rule) { |
| 2772 if (rule.selector === ROOT) { | 2896 if (rule.selector === ROOT) { |
| 2773 rule.selector = 'body'; | 2897 rule.selector = 'html'; |
| 2774 } | 2898 } |
| 2775 }, | 2899 }, |
| 2776 _transformDocumentSelector: function (selector) { | 2900 _transformDocumentSelector: function (selector) { |
| 2777 return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector, SCO
PE_DOC_SELECTOR) : this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELE
CTOR); | 2901 return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector, SCO
PE_DOC_SELECTOR) : this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELE
CTOR); |
| 2778 }, | 2902 }, |
| 2779 SCOPE_NAME: 'style-scope' | 2903 SCOPE_NAME: 'style-scope' |
| 2780 }; | 2904 }; |
| 2781 var SCOPE_NAME = api.SCOPE_NAME; | 2905 var SCOPE_NAME = api.SCOPE_NAME; |
| 2782 var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME +
')'; | 2906 var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME +
')'; |
| 2783 var COMPLEX_SELECTOR_SEP = ','; | 2907 var COMPLEX_SELECTOR_SEP = ','; |
| 2784 var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g; | 2908 var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g; |
| 2909 var SIMPLE_SELECTOR_PREFIX = /[[.:#*]/; |
| 2785 var HOST = ':host'; | 2910 var HOST = ':host'; |
| 2786 var ROOT = ':root'; | 2911 var ROOT = ':root'; |
| 2787 var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g; | 2912 var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; |
| 2788 var HOST_CONTEXT = ':host-context'; | 2913 var HOST_CONTEXT = ':host-context'; |
| 2789 var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))
(.*)/; | 2914 var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))
(.*)/; |
| 2790 var CONTENT = '::content'; | 2915 var CONTENT = '::content'; |
| 2791 var SCOPE_JUMP = /::content|::shadow|\/deep\//; | 2916 var SCOPE_JUMP = /::content|::shadow|\/deep\//; |
| 2792 var CSS_CLASS_PREFIX = '.'; | 2917 var CSS_CLASS_PREFIX = '.'; |
| 2793 var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~='; | 2918 var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~='; |
| 2794 var CSS_ATTR_SUFFIX = ']'; | 2919 var CSS_ATTR_SUFFIX = ']'; |
| 2795 var PSEUDO_PREFIX = ':'; | 2920 var PSEUDO_PREFIX = ':'; |
| 2796 var CLASS = 'class'; | 2921 var CLASS = 'class'; |
| 2797 var CONTENT_START = new RegExp('^(' + CONTENT + ')'); | 2922 var CONTENT_START = new RegExp('^(' + CONTENT + ')'); |
| 2923 var SELECTOR_NO_MATCH = 'should_not_match'; |
| 2798 return api; | 2924 return api; |
| 2799 }(); | 2925 }();Polymer.StyleExtends = function () { |
| 2800 Polymer.StyleExtends = function () { | |
| 2801 var styleUtil = Polymer.StyleUtil; | 2926 var styleUtil = Polymer.StyleUtil; |
| 2802 return { | 2927 return { |
| 2803 hasExtends: function (cssText) { | 2928 hasExtends: function (cssText) { |
| 2804 return Boolean(cssText.match(this.rx.EXTEND)); | 2929 return Boolean(cssText.match(this.rx.EXTEND)); |
| 2805 }, | 2930 }, |
| 2806 transform: function (style) { | 2931 transform: function (style) { |
| 2807 var rules = styleUtil.rulesForStyle(style); | 2932 var rules = styleUtil.rulesForStyle(style); |
| 2808 var self = this; | 2933 var self = this; |
| 2809 styleUtil.forEachRule(rules, function (rule) { | 2934 styleUtil.forEachRule(rules, function (rule) { |
| 2810 self._mapRuleOntoParent(rule); | 2935 self._mapRuleOntoParent(rule); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2860 if (rule.extends) { | 2985 if (rule.extends) { |
| 2861 rule.extends = rule.extends.slice(); | 2986 rule.extends = rule.extends.slice(); |
| 2862 } | 2987 } |
| 2863 parent.rules.push(rule); | 2988 parent.rules.push(rule); |
| 2864 }, | 2989 }, |
| 2865 rx: { | 2990 rx: { |
| 2866 EXTEND: /@extends\(([^)]*)\)\s*?;/gim, | 2991 EXTEND: /@extends\(([^)]*)\)\s*?;/gim, |
| 2867 STRIP: /%[^,]*$/ | 2992 STRIP: /%[^,]*$/ |
| 2868 } | 2993 } |
| 2869 }; | 2994 }; |
| 2870 }(); | 2995 }();Polymer.ApplyShim = function () { |
| 2871 (function () { | 2996 'use strict'; |
| 2997 var styleUtil = Polymer.StyleUtil; |
| 2998 var MIXIN_MATCH = styleUtil.rx.MIXIN_MATCH; |
| 2999 var VAR_ASSIGN = styleUtil.rx.VAR_ASSIGN; |
| 3000 var VAR_MATCH = styleUtil.rx.VAR_MATCH; |
| 3001 var APPLY_NAME_CLEAN = /;\s*/m; |
| 3002 var MIXIN_VAR_SEP = '_-_'; |
| 3003 var mixinMap = {}; |
| 3004 function mapSet(name, prop) { |
| 3005 name = name.trim(); |
| 3006 mixinMap[name] = prop; |
| 3007 } |
| 3008 function mapGet(name) { |
| 3009 name = name.trim(); |
| 3010 return mixinMap[name]; |
| 3011 } |
| 3012 function cssTextToMap(text) { |
| 3013 var props = text.split(';'); |
| 3014 var out = {}; |
| 3015 for (var i = 0, p, sp; i < props.length; i++) { |
| 3016 p = props[i]; |
| 3017 if (p) { |
| 3018 sp = p.split(':'); |
| 3019 if (sp.length > 1) { |
| 3020 out[sp[0].trim()] = sp.slice(1).join(':'); |
| 3021 } |
| 3022 } |
| 3023 } |
| 3024 return out; |
| 3025 } |
| 3026 function produceCssProperties(matchText, propertyName, valueProperty, valueMixin
) { |
| 3027 if (valueProperty) { |
| 3028 VAR_MATCH.lastIndex = 0; |
| 3029 var m = VAR_MATCH.exec(valueProperty); |
| 3030 if (m) { |
| 3031 var value = m[2]; |
| 3032 if (mapGet(value)) { |
| 3033 valueMixin = '@apply ' + value + ';'; |
| 3034 } |
| 3035 } |
| 3036 } |
| 3037 if (!valueMixin) { |
| 3038 return matchText; |
| 3039 } |
| 3040 var mixinAsProperties = consumeCssProperties(valueMixin); |
| 3041 var prefix = matchText.slice(0, matchText.indexOf('--')); |
| 3042 var mixinValues = cssTextToMap(mixinAsProperties); |
| 3043 var oldProperties = mapGet(propertyName); |
| 3044 var combinedProps = mixinValues; |
| 3045 if (oldProperties) { |
| 3046 combinedProps = Polymer.Base.mixin(oldProperties, mixinValues); |
| 3047 } else { |
| 3048 mapSet(propertyName, combinedProps); |
| 3049 } |
| 3050 var out = []; |
| 3051 var p, v; |
| 3052 for (p in combinedProps) { |
| 3053 v = mixinValues[p]; |
| 3054 if (v === undefined) { |
| 3055 v = 'initial'; |
| 3056 } |
| 3057 out.push(propertyName + MIXIN_VAR_SEP + p + ': ' + v); |
| 3058 } |
| 3059 return prefix + out.join('; ') + ';'; |
| 3060 } |
| 3061 function fixVars(matchText, prefix, value, fallback) { |
| 3062 if (!fallback || fallback.indexOf('--') !== 0) { |
| 3063 return matchText; |
| 3064 } |
| 3065 return [ |
| 3066 prefix, |
| 3067 'var(', |
| 3068 value, |
| 3069 ', var(', |
| 3070 fallback, |
| 3071 '));' |
| 3072 ].join(''); |
| 3073 } |
| 3074 function atApplyToCssProperties(mixinName, fallbacks) { |
| 3075 mixinName = mixinName.replace(APPLY_NAME_CLEAN, ''); |
| 3076 var vars = []; |
| 3077 var mixinProperties = mapGet(mixinName); |
| 3078 if (mixinProperties) { |
| 3079 var p, parts, f; |
| 3080 for (p in mixinProperties) { |
| 3081 f = fallbacks && fallbacks[p]; |
| 3082 parts = [ |
| 3083 p, |
| 3084 ': var(', |
| 3085 mixinName, |
| 3086 MIXIN_VAR_SEP, |
| 3087 p |
| 3088 ]; |
| 3089 if (f) { |
| 3090 parts.push(',', f); |
| 3091 } |
| 3092 parts.push(')'); |
| 3093 vars.push(parts.join('')); |
| 3094 } |
| 3095 } |
| 3096 return vars.join('; '); |
| 3097 } |
| 3098 function consumeCssProperties(text) { |
| 3099 var m; |
| 3100 while (m = MIXIN_MATCH.exec(text)) { |
| 3101 var matchText = m[0]; |
| 3102 var mixinName = m[1]; |
| 3103 var idx = m.index; |
| 3104 var applyPos = idx + matchText.indexOf('@apply'); |
| 3105 var afterApplyPos = idx + matchText.length; |
| 3106 var textBeforeApply = text.slice(0, applyPos); |
| 3107 var textAfterApply = text.slice(afterApplyPos); |
| 3108 var defaults = cssTextToMap(textBeforeApply); |
| 3109 var replacement = atApplyToCssProperties(mixinName, defaults); |
| 3110 text = [ |
| 3111 textBeforeApply, |
| 3112 replacement, |
| 3113 textAfterApply |
| 3114 ].join(''); |
| 3115 MIXIN_MATCH.lastIndex = idx + replacement.length; |
| 3116 } |
| 3117 return text; |
| 3118 } |
| 3119 var ApplyShim = { |
| 3120 _map: mixinMap, |
| 3121 _separator: MIXIN_VAR_SEP, |
| 3122 transform: function (styles) { |
| 3123 styleUtil.forRulesInStyles(styles, this._boundTransformRule); |
| 3124 }, |
| 3125 transformRule: function (rule) { |
| 3126 rule.cssText = this.transformCssText(rule.parsedCssText); |
| 3127 if (rule.selector === ':root') { |
| 3128 rule.selector = ':host > *'; |
| 3129 } |
| 3130 }, |
| 3131 transformCssText: function (cssText) { |
| 3132 cssText = cssText.replace(VAR_MATCH, fixVars); |
| 3133 cssText = cssText.replace(VAR_ASSIGN, produceCssProperties); |
| 3134 return consumeCssProperties(cssText); |
| 3135 } |
| 3136 }; |
| 3137 ApplyShim._boundTransformRule = ApplyShim.transformRule.bind(ApplyShim); |
| 3138 return ApplyShim; |
| 3139 }();(function () { |
| 2872 var prepElement = Polymer.Base._prepElement; | 3140 var prepElement = Polymer.Base._prepElement; |
| 2873 var nativeShadow = Polymer.Settings.useNativeShadow; | 3141 var nativeShadow = Polymer.Settings.useNativeShadow; |
| 2874 var styleUtil = Polymer.StyleUtil; | 3142 var styleUtil = Polymer.StyleUtil; |
| 2875 var styleTransformer = Polymer.StyleTransformer; | 3143 var styleTransformer = Polymer.StyleTransformer; |
| 2876 var styleExtends = Polymer.StyleExtends; | 3144 var styleExtends = Polymer.StyleExtends; |
| 3145 var applyShim = Polymer.ApplyShim; |
| 3146 var settings = Polymer.Settings; |
| 2877 Polymer.Base._addFeature({ | 3147 Polymer.Base._addFeature({ |
| 2878 _prepElement: function (element) { | 3148 _prepElement: function (element) { |
| 2879 if (this._encapsulateStyle) { | 3149 if (this._encapsulateStyle && this.__cssBuild !== 'shady') { |
| 2880 styleTransformer.element(element, this.is, this._scopeCssViaAttr); | 3150 styleTransformer.element(element, this.is, this._scopeCssViaAttr); |
| 2881 } | 3151 } |
| 2882 prepElement.call(this, element); | 3152 prepElement.call(this, element); |
| 2883 }, | 3153 }, |
| 2884 _prepStyles: function () { | 3154 _prepStyles: function () { |
| 3155 if (this._encapsulateStyle === undefined) { |
| 3156 this._encapsulateStyle = !nativeShadow; |
| 3157 } |
| 2885 if (!nativeShadow) { | 3158 if (!nativeShadow) { |
| 2886 this._scopeStyle = styleUtil.applyStylePlaceHolder(this.is); | 3159 this._scopeStyle = styleUtil.applyStylePlaceHolder(this.is); |
| 2887 } | 3160 } |
| 3161 this.__cssBuild = styleUtil.cssBuildTypeForModule(this.is); |
| 2888 }, | 3162 }, |
| 2889 _prepShimStyles: function () { | 3163 _prepShimStyles: function () { |
| 2890 if (this._template) { | 3164 if (this._template) { |
| 2891 if (this._encapsulateStyle === undefined) { | 3165 var hasTargetedCssBuild = styleUtil.isTargetedBuild(this.__cssBuild); |
| 2892 this._encapsulateStyle = !nativeShadow; | 3166 if (settings.useNativeCSSProperties && this.__cssBuild === 'shadow' && hasTarget
edCssBuild) { |
| 3167 return; |
| 2893 } | 3168 } |
| 2894 this._styles = this._collectStyles(); | 3169 this._styles = this._styles || this._collectStyles(); |
| 2895 var cssText = styleTransformer.elementStyles(this); | 3170 if (settings.useNativeCSSProperties && !this.__cssBuild) { |
| 3171 applyShim.transform(this._styles); |
| 3172 } |
| 3173 var cssText = settings.useNativeCSSProperties && hasTargetedCssBuild ? this._sty
les.length && this._styles[0].textContent.trim() : styleTransformer.elementStyle
s(this); |
| 2896 this._prepStyleProperties(); | 3174 this._prepStyleProperties(); |
| 2897 if (!this._needsStyleProperties() && this._styles.length) { | 3175 if (!this._needsStyleProperties() && cssText) { |
| 2898 styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : nul
l, this._scopeStyle); | 3176 styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : nul
l, this._scopeStyle); |
| 2899 } | 3177 } |
| 2900 } else { | 3178 } else { |
| 2901 this._styles = []; | 3179 this._styles = []; |
| 2902 } | 3180 } |
| 2903 }, | 3181 }, |
| 2904 _collectStyles: function () { | 3182 _collectStyles: function () { |
| 2905 var styles = []; | 3183 var styles = []; |
| 2906 var cssText = '', m$ = this.styleModules; | 3184 var cssText = '', m$ = this.styleModules; |
| 2907 if (m$) { | 3185 if (m$) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2966 } | 3244 } |
| 2967 }); | 3245 }); |
| 2968 mo.observe(container, { | 3246 mo.observe(container, { |
| 2969 childList: true, | 3247 childList: true, |
| 2970 subtree: true | 3248 subtree: true |
| 2971 }); | 3249 }); |
| 2972 return mo; | 3250 return mo; |
| 2973 } | 3251 } |
| 2974 } | 3252 } |
| 2975 }); | 3253 }); |
| 2976 }()); | 3254 }());Polymer.StyleProperties = function () { |
| 2977 Polymer.StyleProperties = function () { | |
| 2978 'use strict'; | 3255 'use strict'; |
| 2979 var nativeShadow = Polymer.Settings.useNativeShadow; | |
| 2980 var matchesSelector = Polymer.DomApi.matchesSelector; | 3256 var matchesSelector = Polymer.DomApi.matchesSelector; |
| 2981 var styleUtil = Polymer.StyleUtil; | 3257 var styleUtil = Polymer.StyleUtil; |
| 2982 var styleTransformer = Polymer.StyleTransformer; | 3258 var styleTransformer = Polymer.StyleTransformer; |
| 3259 var settings = Polymer.Settings; |
| 2983 return { | 3260 return { |
| 2984 decorateStyles: function (styles) { | 3261 decorateStyles: function (styles, scope) { |
| 2985 var self = this, props = {}, keyframes = []; | 3262 var self = this, props = {}, keyframes = [], ruleIndex = 0; |
| 2986 styleUtil.forRulesInStyles(styles, function (rule) { | 3263 var scopeSelector = styleTransformer._calcHostScope(scope.is, scope.extends); |
| 3264 styleUtil.forRulesInStyles(styles, function (rule, style) { |
| 2987 self.decorateRule(rule); | 3265 self.decorateRule(rule); |
| 3266 rule.index = ruleIndex++; |
| 3267 self.whenHostOrRootRule(scope, rule, style, function (info) { |
| 3268 if (rule.parent.type === styleUtil.ruleTypes.MEDIA_RULE) { |
| 3269 scope.__notStyleScopeCacheable = true; |
| 3270 } |
| 3271 if (info.isHost) { |
| 3272 var hostContextOrFunction = info.selector.split(' ').some(function (s) { |
| 3273 return s.indexOf(scopeSelector) === 0 && s.length !== scopeSelector.length; |
| 3274 }); |
| 3275 scope.__notStyleScopeCacheable = scope.__notStyleScopeCacheable || hostContextOr
Function; |
| 3276 } |
| 3277 }); |
| 2988 self.collectPropertiesInCssText(rule.propertyInfo.cssText, props); | 3278 self.collectPropertiesInCssText(rule.propertyInfo.cssText, props); |
| 2989 }, function onKeyframesRule(rule) { | 3279 }, function onKeyframesRule(rule) { |
| 2990 keyframes.push(rule); | 3280 keyframes.push(rule); |
| 2991 }); | 3281 }); |
| 2992 styles._keyframes = keyframes; | 3282 styles._keyframes = keyframes; |
| 2993 var names = []; | 3283 var names = []; |
| 2994 for (var i in props) { | 3284 for (var i in props) { |
| 2995 names.push(i); | 3285 names.push(i); |
| 2996 } | 3286 } |
| 2997 return names; | 3287 return names; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3015 if (info) { | 3305 if (info) { |
| 3016 if (info.properties) { | 3306 if (info.properties) { |
| 3017 Polymer.Base.mixin(properties, info.properties); | 3307 Polymer.Base.mixin(properties, info.properties); |
| 3018 return true; | 3308 return true; |
| 3019 } | 3309 } |
| 3020 } else { | 3310 } else { |
| 3021 var m, rx = this.rx.VAR_ASSIGN; | 3311 var m, rx = this.rx.VAR_ASSIGN; |
| 3022 var cssText = rule.parsedCssText; | 3312 var cssText = rule.parsedCssText; |
| 3023 var any; | 3313 var any; |
| 3024 while (m = rx.exec(cssText)) { | 3314 while (m = rx.exec(cssText)) { |
| 3025 properties[m[1]] = (m[2] || m[3]).trim(); | 3315 properties[m[1].trim()] = (m[2] || m[3]).trim(); |
| 3026 any = true; | 3316 any = true; |
| 3027 } | 3317 } |
| 3028 return any; | 3318 return any; |
| 3029 } | 3319 } |
| 3030 }, | 3320 }, |
| 3031 collectCssText: function (rule) { | 3321 collectCssText: function (rule) { |
| 3032 return this.collectConsumingCssText(rule.parsedCssText); | 3322 return this.collectConsumingCssText(rule.parsedCssText); |
| 3033 }, | 3323 }, |
| 3034 collectConsumingCssText: function (cssText) { | 3324 collectConsumingCssText: function (cssText) { |
| 3035 return cssText.replace(this.rx.BRACKETED, '').replace(this.rx.VAR_ASSIGN, ''); | 3325 return cssText.replace(this.rx.BRACKETED, '').replace(this.rx.VAR_ASSIGN, ''); |
| 3036 }, | 3326 }, |
| 3037 collectPropertiesInCssText: function (cssText, props) { | 3327 collectPropertiesInCssText: function (cssText, props) { |
| 3038 var m; | 3328 var m; |
| 3039 while (m = this.rx.VAR_CAPTURE.exec(cssText)) { | 3329 while (m = this.rx.VAR_CONSUMED.exec(cssText)) { |
| 3040 props[m[1]] = true; | 3330 var name = m[1]; |
| 3041 var def = m[2]; | 3331 if (m[2] !== ':') { |
| 3042 if (def && def.match(this.rx.IS_VAR)) { | 3332 props[name] = true; |
| 3043 props[def] = true; | |
| 3044 } | 3333 } |
| 3045 } | 3334 } |
| 3046 }, | 3335 }, |
| 3047 reify: function (props) { | 3336 reify: function (props) { |
| 3048 var names = Object.getOwnPropertyNames(props); | 3337 var names = Object.getOwnPropertyNames(props); |
| 3049 for (var i = 0, n; i < names.length; i++) { | 3338 for (var i = 0, n; i < names.length; i++) { |
| 3050 n = names[i]; | 3339 n = names[i]; |
| 3051 props[n] = this.valueForProperty(props[n], props); | 3340 props[n] = this.valueForProperty(props[n], props); |
| 3052 } | 3341 } |
| 3053 }, | 3342 }, |
| 3054 valueForProperty: function (property, props) { | 3343 valueForProperty: function (property, props) { |
| 3055 if (property) { | 3344 if (property) { |
| 3056 if (property.indexOf(';') >= 0) { | 3345 if (property.indexOf(';') >= 0) { |
| 3057 property = this.valueForProperties(property, props); | 3346 property = this.valueForProperties(property, props); |
| 3058 } else { | 3347 } else { |
| 3059 var self = this; | 3348 var self = this; |
| 3060 var fn = function (all, prefix, value, fallback) { | 3349 var fn = function (all, prefix, value, fallback) { |
| 3061 var propertyValue = self.valueForProperty(props[value], props) || (props[fallbac
k] ? self.valueForProperty(props[fallback], props) : fallback); | 3350 var propertyValue = self.valueForProperty(props[value], props) || self.valueForP
roperty(props[fallback] || fallback, props) || fallback; |
| 3062 return prefix + (propertyValue || ''); | 3351 return prefix + (propertyValue || ''); |
| 3063 }; | 3352 }; |
| 3064 property = property.replace(this.rx.VAR_MATCH, fn); | 3353 property = property.replace(this.rx.VAR_MATCH, fn); |
| 3065 } | 3354 } |
| 3066 } | 3355 } |
| 3067 return property && property.trim() || ''; | 3356 return property && property.trim() || ''; |
| 3068 }, | 3357 }, |
| 3069 valueForProperties: function (property, props) { | 3358 valueForProperties: function (property, props) { |
| 3070 var parts = property.split(';'); | 3359 var parts = property.split(';'); |
| 3071 for (var i = 0, p, m; i < parts.length; i++) { | 3360 for (var i = 0, p, m; i < parts.length; i++) { |
| 3072 if (p = parts[i]) { | 3361 if (p = parts[i]) { |
| 3073 m = p.match(this.rx.MIXIN_MATCH); | 3362 this.rx.MIXIN_MATCH.lastIndex = 0; |
| 3363 m = this.rx.MIXIN_MATCH.exec(p); |
| 3074 if (m) { | 3364 if (m) { |
| 3075 p = this.valueForProperty(props[m[1]], props); | 3365 p = this.valueForProperty(props[m[1]], props); |
| 3076 } else { | 3366 } else { |
| 3077 var colon = p.indexOf(':'); | 3367 var colon = p.indexOf(':'); |
| 3078 if (colon !== -1) { | 3368 if (colon !== -1) { |
| 3079 var pp = p.substring(colon); | 3369 var pp = p.substring(colon); |
| 3080 pp = pp.trim(); | 3370 pp = pp.trim(); |
| 3081 pp = this.valueForProperty(pp, props) || pp; | 3371 pp = this.valueForProperty(pp, props) || pp; |
| 3082 p = p.substring(0, colon) + pp; | 3372 p = p.substring(0, colon) + pp; |
| 3083 } | 3373 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3120 transform = keyframeTransforms[rule.keyframeNamesToTransform[i]]; | 3410 transform = keyframeTransforms[rule.keyframeNamesToTransform[i]]; |
| 3121 input = transform(input); | 3411 input = transform(input); |
| 3122 } | 3412 } |
| 3123 output = input; | 3413 output = input; |
| 3124 } | 3414 } |
| 3125 } | 3415 } |
| 3126 rule.cssText = output; | 3416 rule.cssText = output; |
| 3127 }, | 3417 }, |
| 3128 propertyDataFromStyles: function (styles, element) { | 3418 propertyDataFromStyles: function (styles, element) { |
| 3129 var props = {}, self = this; | 3419 var props = {}, self = this; |
| 3130 var o = [], i = 0; | 3420 var o = []; |
| 3131 styleUtil.forRulesInStyles(styles, function (rule) { | 3421 styleUtil.forActiveRulesInStyles(styles, function (rule) { |
| 3132 if (!rule.propertyInfo) { | 3422 if (!rule.propertyInfo) { |
| 3133 self.decorateRule(rule); | 3423 self.decorateRule(rule); |
| 3134 } | 3424 } |
| 3135 if (element && rule.propertyInfo.properties && matchesSelector.call(element, rul
e.transformedSelector || rule.parsedSelector)) { | 3425 var selectorToMatch = rule.transformedSelector || rule.parsedSelector; |
| 3426 if (element && rule.propertyInfo.properties && selectorToMatch) { |
| 3427 if (matchesSelector.call(element, selectorToMatch)) { |
| 3136 self.collectProperties(rule, props); | 3428 self.collectProperties(rule, props); |
| 3137 addToBitMask(i, o); | 3429 addToBitMask(rule.index, o); |
| 3138 } | 3430 } |
| 3139 i++; | 3431 } |
| 3140 }); | 3432 }); |
| 3141 return { | 3433 return { |
| 3142 properties: props, | 3434 properties: props, |
| 3143 key: o | 3435 key: o |
| 3144 }; | 3436 }; |
| 3145 }, | 3437 }, |
| 3146 scopePropertiesFromStyles: function (styles) { | 3438 whenHostOrRootRule: function (scope, rule, style, callback) { |
| 3147 if (!styles._scopeStyleProperties) { | |
| 3148 styles._scopeStyleProperties = this.selectedPropertiesFromStyles(styles, this.SC
OPE_SELECTORS); | |
| 3149 } | |
| 3150 return styles._scopeStyleProperties; | |
| 3151 }, | |
| 3152 hostPropertiesFromStyles: function (styles) { | |
| 3153 if (!styles._hostStyleProperties) { | |
| 3154 styles._hostStyleProperties = this.selectedPropertiesFromStyles(styles, this.HOS
T_SELECTORS); | |
| 3155 } | |
| 3156 return styles._hostStyleProperties; | |
| 3157 }, | |
| 3158 selectedPropertiesFromStyles: function (styles, selectors) { | |
| 3159 var props = {}, self = this; | |
| 3160 styleUtil.forRulesInStyles(styles, function (rule) { | |
| 3161 if (!rule.propertyInfo) { | 3439 if (!rule.propertyInfo) { |
| 3162 self.decorateRule(rule); | 3440 self.decorateRule(rule); |
| 3163 } | 3441 } |
| 3164 for (var i = 0; i < selectors.length; i++) { | 3442 if (!rule.propertyInfo.properties) { |
| 3165 if (rule.parsedSelector === selectors[i]) { | |
| 3166 self.collectProperties(rule, props); | |
| 3167 return; | 3443 return; |
| 3168 } | 3444 } |
| 3445 var hostScope = scope.is ? styleTransformer._calcHostScope(scope.is, scope.exten
ds) : 'html'; |
| 3446 var parsedSelector = rule.parsedSelector; |
| 3447 var isRoot = parsedSelector === ':root'; |
| 3448 var isHost = parsedSelector.indexOf(':host') === 0; |
| 3449 var cssBuild = scope.__cssBuild || style.__cssBuild; |
| 3450 if (cssBuild === 'shady') { |
| 3451 isRoot = parsedSelector === hostScope + '> *.' + hostScope || parsedSelector.ind
exOf('html') !== -1; |
| 3452 isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0; |
| 3453 } |
| 3454 if (cssBuild === 'shadow') { |
| 3455 isRoot = parsedSelector === ':host > *' || parsedSelector === 'html'; |
| 3456 isHost = isHost && !isRoot; |
| 3457 } |
| 3458 if (!isRoot && !isHost) { |
| 3459 return; |
| 3460 } |
| 3461 var selectorToMatch = hostScope; |
| 3462 if (isHost) { |
| 3463 if (settings.useNativeShadow && !rule.transformedSelector) { |
| 3464 rule.transformedSelector = styleTransformer._transformRuleCss(rule, styleTransfo
rmer._transformComplexSelector, scope.is, hostScope); |
| 3465 } |
| 3466 selectorToMatch = rule.transformedSelector || hostScope; |
| 3467 } |
| 3468 callback({ |
| 3469 selector: selectorToMatch, |
| 3470 isHost: isHost, |
| 3471 isRoot: isRoot |
| 3472 }); |
| 3473 }, |
| 3474 hostAndRootPropertiesForScope: function (scope) { |
| 3475 var hostProps = {}, rootProps = {}, self = this; |
| 3476 styleUtil.forActiveRulesInStyles(scope._styles, function (rule, style) { |
| 3477 self.whenHostOrRootRule(scope, rule, style, function (info) { |
| 3478 var element = scope._element || scope; |
| 3479 if (matchesSelector.call(element, info.selector)) { |
| 3480 if (info.isHost) { |
| 3481 self.collectProperties(rule, hostProps); |
| 3482 } else { |
| 3483 self.collectProperties(rule, rootProps); |
| 3484 } |
| 3169 } | 3485 } |
| 3170 }); | 3486 }); |
| 3171 return props; | 3487 }); |
| 3488 return { |
| 3489 rootProps: rootProps, |
| 3490 hostProps: hostProps |
| 3491 }; |
| 3172 }, | 3492 }, |
| 3173 transformStyles: function (element, properties, scopeSelector) { | 3493 transformStyles: function (element, properties, scopeSelector) { |
| 3174 var self = this; | 3494 var self = this; |
| 3175 var hostSelector = styleTransformer._calcHostScope(element.is, element.extends); | 3495 var hostSelector = styleTransformer._calcHostScope(element.is, element.extends); |
| 3176 var rxHostSelector = element.extends ? '\\' + hostSelector.slice(0, -1) + '\\]'
: hostSelector; | 3496 var rxHostSelector = element.extends ? '\\' + hostSelector.slice(0, -1) + '\\]'
: hostSelector; |
| 3177 var hostRx = new RegExp(this.rx.HOST_PREFIX + rxHostSelector + this.rx.HOST_SUFF
IX); | 3497 var hostRx = new RegExp(this.rx.HOST_PREFIX + rxHostSelector + this.rx.HOST_SUFF
IX); |
| 3178 var keyframeTransforms = this._elementKeyframeTransforms(element, scopeSelector)
; | 3498 var keyframeTransforms = this._elementKeyframeTransforms(element, scopeSelector)
; |
| 3179 return styleTransformer.elementStyles(element, function (rule) { | 3499 return styleTransformer.elementStyles(element, function (rule) { |
| 3180 self.applyProperties(rule, properties); | 3500 self.applyProperties(rule, properties); |
| 3181 if (!nativeShadow && !Polymer.StyleUtil.isKeyframesSelector(rule) && rule.cssTex
t) { | 3501 if (!settings.useNativeShadow && !Polymer.StyleUtil.isKeyframesSelector(rule) &&
rule.cssText) { |
| 3182 self.applyKeyframeTransforms(rule, keyframeTransforms); | 3502 self.applyKeyframeTransforms(rule, keyframeTransforms); |
| 3183 self._scopeSelector(rule, hostRx, hostSelector, element._scopeCssViaAttr, scopeS
elector); | 3503 self._scopeSelector(rule, hostRx, hostSelector, element._scopeCssViaAttr, scopeS
elector); |
| 3184 } | 3504 } |
| 3185 }); | 3505 }); |
| 3186 }, | 3506 }, |
| 3187 _elementKeyframeTransforms: function (element, scopeSelector) { | 3507 _elementKeyframeTransforms: function (element, scopeSelector) { |
| 3188 var keyframesRules = element._styles._keyframes; | 3508 var keyframesRules = element._styles._keyframes; |
| 3189 var keyframeTransforms = {}; | 3509 var keyframeTransforms = {}; |
| 3190 if (!nativeShadow && keyframesRules) { | 3510 if (!settings.useNativeShadow && keyframesRules) { |
| 3191 for (var i = 0, keyframesRule = keyframesRules[i]; i < keyframesRules.length; ke
yframesRule = keyframesRules[++i]) { | 3511 for (var i = 0, keyframesRule = keyframesRules[i]; i < keyframesRules.length; ke
yframesRule = keyframesRules[++i]) { |
| 3192 this._scopeKeyframes(keyframesRule, scopeSelector); | 3512 this._scopeKeyframes(keyframesRule, scopeSelector); |
| 3193 keyframeTransforms[keyframesRule.keyframesName] = this._keyframesRuleTransformer
(keyframesRule); | 3513 keyframeTransforms[keyframesRule.keyframesName] = this._keyframesRuleTransformer
(keyframesRule); |
| 3194 } | 3514 } |
| 3195 } | 3515 } |
| 3196 return keyframeTransforms; | 3516 return keyframeTransforms; |
| 3197 }, | 3517 }, |
| 3198 _keyframesRuleTransformer: function (keyframesRule) { | 3518 _keyframesRuleTransformer: function (keyframesRule) { |
| 3199 return function (cssText) { | 3519 return function (cssText) { |
| 3200 return cssText.replace(keyframesRule.keyframesNameRx, keyframesRule.transformedK
eyframesName); | 3520 return cssText.replace(keyframesRule.keyframesNameRx, keyframesRule.transformedK
eyframesName); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3223 if (viaAttr) { | 3543 if (viaAttr) { |
| 3224 element.setAttribute(styleTransformer.SCOPE_NAME, v); | 3544 element.setAttribute(styleTransformer.SCOPE_NAME, v); |
| 3225 } else { | 3545 } else { |
| 3226 element.setAttribute('class', v); | 3546 element.setAttribute('class', v); |
| 3227 } | 3547 } |
| 3228 } | 3548 } |
| 3229 }, | 3549 }, |
| 3230 applyElementStyle: function (element, properties, selector, style) { | 3550 applyElementStyle: function (element, properties, selector, style) { |
| 3231 var cssText = style ? style.textContent || '' : this.transformStyles(element, pr
operties, selector); | 3551 var cssText = style ? style.textContent || '' : this.transformStyles(element, pr
operties, selector); |
| 3232 var s = element._customStyle; | 3552 var s = element._customStyle; |
| 3233 if (s && !nativeShadow && s !== style) { | 3553 if (s && !settings.useNativeShadow && s !== style) { |
| 3234 s._useCount--; | 3554 s._useCount--; |
| 3235 if (s._useCount <= 0 && s.parentNode) { | 3555 if (s._useCount <= 0 && s.parentNode) { |
| 3236 s.parentNode.removeChild(s); | 3556 s.parentNode.removeChild(s); |
| 3237 } | 3557 } |
| 3238 } | 3558 } |
| 3239 if (nativeShadow || (!style || !style.parentNode)) { | 3559 if (settings.useNativeShadow) { |
| 3240 if (nativeShadow && element._customStyle) { | 3560 if (element._customStyle) { |
| 3241 element._customStyle.textContent = cssText; | 3561 element._customStyle.textContent = cssText; |
| 3242 style = element._customStyle; | 3562 style = element._customStyle; |
| 3243 } else if (cssText) { | 3563 } else if (cssText) { |
| 3244 style = styleUtil.applyCss(cssText, selector, nativeShadow ? element.root : null
, element._scopeStyle); | 3564 style = styleUtil.applyCss(cssText, selector, element.root, element._scopeStyle)
; |
| 3565 } |
| 3566 } else { |
| 3567 if (!style) { |
| 3568 if (cssText) { |
| 3569 style = styleUtil.applyCss(cssText, selector, null, element._scopeStyle); |
| 3570 } |
| 3571 } else if (!style.parentNode) { |
| 3572 styleUtil.applyStyle(style, null, element._scopeStyle); |
| 3245 } | 3573 } |
| 3246 } | 3574 } |
| 3247 if (style) { | 3575 if (style) { |
| 3248 style._useCount = style._useCount || 0; | 3576 style._useCount = style._useCount || 0; |
| 3249 if (element._customStyle != style) { | 3577 if (element._customStyle != style) { |
| 3250 style._useCount++; | 3578 style._useCount++; |
| 3251 } | 3579 } |
| 3252 element._customStyle = style; | 3580 element._customStyle = style; |
| 3253 } | 3581 } |
| 3254 return style; | 3582 return style; |
| 3255 }, | 3583 }, |
| 3256 mixinCustomStyle: function (props, customStyle) { | 3584 mixinCustomStyle: function (props, customStyle) { |
| 3257 var v; | 3585 var v; |
| 3258 for (var i in customStyle) { | 3586 for (var i in customStyle) { |
| 3259 v = customStyle[i]; | 3587 v = customStyle[i]; |
| 3260 if (v || v === 0) { | 3588 if (v || v === 0) { |
| 3261 props[i] = v; | 3589 props[i] = v; |
| 3262 } | 3590 } |
| 3263 } | 3591 } |
| 3264 }, | 3592 }, |
| 3265 rx: { | 3593 updateNativeStyleProperties: function (element, properties) { |
| 3266 VAR_ASSIGN: /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}]
)|$)/gi, | 3594 for (var i = 0; i < element.style.length; i++) { |
| 3267 MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i, | 3595 element.style.removeProperty(element.style[i]); |
| 3268 VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,()]*)|(?:[^;()]*\([^;)]*
\)))[\s]*?\)/gi, | 3596 } |
| 3269 VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi, | 3597 for (var p in properties) { |
| 3270 ANIMATION_MATCH: /(animation\s*:)|(animation-name\s*:)/, | 3598 if (properties[p] !== null) { |
| 3271 IS_VAR: /^--/, | 3599 element.style.setProperty(p, properties[p]); |
| 3272 BRACKETED: /\{[^}]*\}/g, | 3600 } |
| 3273 HOST_PREFIX: '(?:^|[^.#[:])', | 3601 } |
| 3274 HOST_SUFFIX: '($|[.:[\\s>+~])' | |
| 3275 }, | 3602 }, |
| 3276 HOST_SELECTORS: [':host'], | 3603 rx: styleUtil.rx, |
| 3277 SCOPE_SELECTORS: [':root'], | |
| 3278 XSCOPE_NAME: 'x-scope' | 3604 XSCOPE_NAME: 'x-scope' |
| 3279 }; | 3605 }; |
| 3280 function addToBitMask(n, bits) { | 3606 function addToBitMask(n, bits) { |
| 3281 var o = parseInt(n / 32); | 3607 var o = parseInt(n / 32); |
| 3282 var v = 1 << n % 32; | 3608 var v = 1 << n % 32; |
| 3283 bits[o] = (bits[o] || 0) | v; | 3609 bits[o] = (bits[o] || 0) | v; |
| 3284 } | 3610 } |
| 3285 }(); | 3611 }();(function () { |
| 3286 (function () { | |
| 3287 Polymer.StyleCache = function () { | 3612 Polymer.StyleCache = function () { |
| 3288 this.cache = {}; | 3613 this.cache = {}; |
| 3289 }; | 3614 }; |
| 3290 Polymer.StyleCache.prototype = { | 3615 Polymer.StyleCache.prototype = { |
| 3291 MAX: 100, | 3616 MAX: 100, |
| 3292 store: function (is, data, keyValues, keyStyles) { | 3617 store: function (is, data, keyValues, keyStyles) { |
| 3293 data.keyValues = keyValues; | 3618 data.keyValues = keyValues; |
| 3294 data.styles = keyStyles; | 3619 data.styles = keyStyles; |
| 3295 var s$ = this.cache[is] = this.cache[is] || []; | 3620 var s$ = this.cache[is] = this.cache[is] || []; |
| 3296 s$.push(data); | 3621 s$.push(data); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3322 } | 3647 } |
| 3323 if (Array.isArray(target)) { | 3648 if (Array.isArray(target)) { |
| 3324 return target.length === source.length; | 3649 return target.length === source.length; |
| 3325 } | 3650 } |
| 3326 return true; | 3651 return true; |
| 3327 }, | 3652 }, |
| 3328 _objectsStrictlyEqual: function (target, source) { | 3653 _objectsStrictlyEqual: function (target, source) { |
| 3329 return this._objectsEqual(target, source) && this._objectsEqual(source, target); | 3654 return this._objectsEqual(target, source) && this._objectsEqual(source, target); |
| 3330 } | 3655 } |
| 3331 }; | 3656 }; |
| 3332 }()); | 3657 }());Polymer.StyleDefaults = function () { |
| 3333 Polymer.StyleDefaults = function () { | |
| 3334 var styleProperties = Polymer.StyleProperties; | 3658 var styleProperties = Polymer.StyleProperties; |
| 3335 var StyleCache = Polymer.StyleCache; | 3659 var StyleCache = Polymer.StyleCache; |
| 3660 var nativeVariables = Polymer.Settings.useNativeCSSProperties; |
| 3336 var api = { | 3661 var api = { |
| 3337 _styles: [], | 3662 _styles: [], |
| 3338 _properties: null, | 3663 _properties: null, |
| 3339 customStyle: {}, | 3664 customStyle: {}, |
| 3340 _styleCache: new StyleCache(), | 3665 _styleCache: new StyleCache(), |
| 3666 _element: Polymer.DomApi.wrap(document.documentElement), |
| 3341 addStyle: function (style) { | 3667 addStyle: function (style) { |
| 3342 this._styles.push(style); | 3668 this._styles.push(style); |
| 3343 this._properties = null; | 3669 this._properties = null; |
| 3344 }, | 3670 }, |
| 3345 get _styleProperties() { | 3671 get _styleProperties() { |
| 3346 if (!this._properties) { | 3672 if (!this._properties) { |
| 3347 styleProperties.decorateStyles(this._styles); | 3673 styleProperties.decorateStyles(this._styles, this); |
| 3348 this._styles._scopeStyleProperties = null; | 3674 this._styles._scopeStyleProperties = null; |
| 3349 this._properties = styleProperties.scopePropertiesFromStyles(this._styles); | 3675 this._properties = styleProperties.hostAndRootPropertiesForScope(this).rootProps
; |
| 3350 styleProperties.mixinCustomStyle(this._properties, this.customStyle); | 3676 styleProperties.mixinCustomStyle(this._properties, this.customStyle); |
| 3351 styleProperties.reify(this._properties); | 3677 styleProperties.reify(this._properties); |
| 3352 } | 3678 } |
| 3353 return this._properties; | 3679 return this._properties; |
| 3354 }, | 3680 }, |
| 3681 hasStyleProperties: function () { |
| 3682 return Boolean(this._properties); |
| 3683 }, |
| 3355 _needsStyleProperties: function () { | 3684 _needsStyleProperties: function () { |
| 3356 }, | 3685 }, |
| 3357 _computeStyleProperties: function () { | 3686 _computeStyleProperties: function () { |
| 3358 return this._styleProperties; | 3687 return this._styleProperties; |
| 3359 }, | 3688 }, |
| 3360 updateStyles: function (properties) { | 3689 updateStyles: function (properties) { |
| 3361 this._properties = null; | 3690 this._properties = null; |
| 3362 if (properties) { | 3691 if (properties) { |
| 3363 Polymer.Base.mixin(this.customStyle, properties); | 3692 Polymer.Base.mixin(this.customStyle, properties); |
| 3364 } | 3693 } |
| 3365 this._styleCache.clear(); | 3694 this._styleCache.clear(); |
| 3366 for (var i = 0, s; i < this._styles.length; i++) { | 3695 for (var i = 0, s; i < this._styles.length; i++) { |
| 3367 s = this._styles[i]; | 3696 s = this._styles[i]; |
| 3368 s = s.__importElement || s; | 3697 s = s.__importElement || s; |
| 3369 s._apply(); | 3698 s._apply(); |
| 3370 } | 3699 } |
| 3700 if (nativeVariables) { |
| 3701 styleProperties.updateNativeStyleProperties(document.documentElement, this.custo
mStyle); |
| 3702 } |
| 3371 } | 3703 } |
| 3372 }; | 3704 }; |
| 3373 return api; | 3705 return api; |
| 3374 }(); | 3706 }();(function () { |
| 3375 (function () { | |
| 3376 'use strict'; | 3707 'use strict'; |
| 3377 var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute; | 3708 var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute; |
| 3378 var propertyUtils = Polymer.StyleProperties; | 3709 var propertyUtils = Polymer.StyleProperties; |
| 3379 var styleTransformer = Polymer.StyleTransformer; | 3710 var styleTransformer = Polymer.StyleTransformer; |
| 3380 var styleDefaults = Polymer.StyleDefaults; | 3711 var styleDefaults = Polymer.StyleDefaults; |
| 3381 var nativeShadow = Polymer.Settings.useNativeShadow; | 3712 var nativeShadow = Polymer.Settings.useNativeShadow; |
| 3713 var nativeVariables = Polymer.Settings.useNativeCSSProperties; |
| 3382 Polymer.Base._addFeature({ | 3714 Polymer.Base._addFeature({ |
| 3383 _prepStyleProperties: function () { | 3715 _prepStyleProperties: function () { |
| 3384 this._ownStylePropertyNames = this._styles && this._styles.length ? propertyUtil
s.decorateStyles(this._styles) : null; | 3716 if (!nativeVariables) { |
| 3717 this._ownStylePropertyNames = this._styles && this._styles.length ? propertyUtil
s.decorateStyles(this._styles, this) : null; |
| 3718 } |
| 3385 }, | 3719 }, |
| 3386 customStyle: null, | 3720 customStyle: null, |
| 3387 getComputedStyleValue: function (property) { | 3721 getComputedStyleValue: function (property) { |
| 3388 return this._styleProperties && this._styleProperties[property] || getComputedSt
yle(this).getPropertyValue(property); | 3722 return !nativeVariables && this._styleProperties && this._styleProperties[proper
ty] || getComputedStyle(this).getPropertyValue(property); |
| 3389 }, | 3723 }, |
| 3390 _setupStyleProperties: function () { | 3724 _setupStyleProperties: function () { |
| 3391 this.customStyle = {}; | 3725 this.customStyle = {}; |
| 3392 this._styleCache = null; | 3726 this._styleCache = null; |
| 3393 this._styleProperties = null; | 3727 this._styleProperties = null; |
| 3394 this._scopeSelector = null; | 3728 this._scopeSelector = null; |
| 3395 this._ownStyleProperties = null; | 3729 this._ownStyleProperties = null; |
| 3396 this._customStyle = null; | 3730 this._customStyle = null; |
| 3397 }, | 3731 }, |
| 3398 _needsStyleProperties: function () { | 3732 _needsStyleProperties: function () { |
| 3399 return Boolean(this._ownStylePropertyNames && this._ownStylePropertyNames.length
); | 3733 return Boolean(!nativeVariables && this._ownStylePropertyNames && this._ownStyle
PropertyNames.length); |
| 3400 }, | 3734 }, |
| 3401 _beforeAttached: function () { | 3735 _beforeAttached: function () { |
| 3402 if (!this._scopeSelector && this._needsStyleProperties()) { | 3736 if ((!this._scopeSelector || this.__stylePropertiesInvalid) && this._needsStyleP
roperties()) { |
| 3737 this.__stylePropertiesInvalid = false; |
| 3403 this._updateStyleProperties(); | 3738 this._updateStyleProperties(); |
| 3404 } | 3739 } |
| 3405 }, | 3740 }, |
| 3406 _findStyleHost: function () { | 3741 _findStyleHost: function () { |
| 3407 var e = this, root; | 3742 var e = this, root; |
| 3408 while (root = Polymer.dom(e).getOwnerRoot()) { | 3743 while (root = Polymer.dom(e).getOwnerRoot()) { |
| 3409 if (Polymer.isInstance(root.host)) { | 3744 if (Polymer.isInstance(root.host)) { |
| 3410 return root.host; | 3745 return root.host; |
| 3411 } | 3746 } |
| 3412 e = root.host; | 3747 e = root.host; |
| 3413 } | 3748 } |
| 3414 return styleDefaults; | 3749 return styleDefaults; |
| 3415 }, | 3750 }, |
| 3416 _updateStyleProperties: function () { | 3751 _updateStyleProperties: function () { |
| 3417 var info, scope = this._findStyleHost(); | 3752 var info, scope = this._findStyleHost(); |
| 3418 if (!scope._styleCache) { | 3753 if (!scope._styleCache) { |
| 3419 scope._styleCache = new Polymer.StyleCache(); | 3754 scope._styleCache = new Polymer.StyleCache(); |
| 3420 } | 3755 } |
| 3421 var scopeData = propertyUtils.propertyDataFromStyles(scope._styles, this); | 3756 var scopeData = propertyUtils.propertyDataFromStyles(scope._styles, this); |
| 3757 var scopeCacheable = !this.__notStyleScopeCacheable; |
| 3758 if (scopeCacheable) { |
| 3422 scopeData.key.customStyle = this.customStyle; | 3759 scopeData.key.customStyle = this.customStyle; |
| 3423 info = scope._styleCache.retrieve(this.is, scopeData.key, this._styles); | 3760 info = scope._styleCache.retrieve(this.is, scopeData.key, this._styles); |
| 3761 } |
| 3424 var scopeCached = Boolean(info); | 3762 var scopeCached = Boolean(info); |
| 3425 if (scopeCached) { | 3763 if (scopeCached) { |
| 3426 this._styleProperties = info._styleProperties; | 3764 this._styleProperties = info._styleProperties; |
| 3427 } else { | 3765 } else { |
| 3428 this._computeStyleProperties(scopeData.properties); | 3766 this._computeStyleProperties(scopeData.properties); |
| 3429 } | 3767 } |
| 3430 this._computeOwnStyleProperties(); | 3768 this._computeOwnStyleProperties(); |
| 3431 if (!scopeCached) { | 3769 if (!scopeCached) { |
| 3432 info = styleCache.retrieve(this.is, this._ownStyleProperties, this._styles); | 3770 info = styleCache.retrieve(this.is, this._ownStyleProperties, this._styles); |
| 3433 } | 3771 } |
| 3434 var globalCached = Boolean(info) && !scopeCached; | 3772 var globalCached = Boolean(info) && !scopeCached; |
| 3435 var style = this._applyStyleProperties(info); | 3773 var style = this._applyStyleProperties(info); |
| 3436 if (!scopeCached) { | 3774 if (!scopeCached) { |
| 3437 style = style && nativeShadow ? style.cloneNode(true) : style; | 3775 style = style && nativeShadow ? style.cloneNode(true) : style; |
| 3438 info = { | 3776 info = { |
| 3439 style: style, | 3777 style: style, |
| 3440 _scopeSelector: this._scopeSelector, | 3778 _scopeSelector: this._scopeSelector, |
| 3441 _styleProperties: this._styleProperties | 3779 _styleProperties: this._styleProperties |
| 3442 }; | 3780 }; |
| 3781 if (scopeCacheable) { |
| 3443 scopeData.key.customStyle = {}; | 3782 scopeData.key.customStyle = {}; |
| 3444 this.mixin(scopeData.key.customStyle, this.customStyle); | 3783 this.mixin(scopeData.key.customStyle, this.customStyle); |
| 3445 scope._styleCache.store(this.is, info, scopeData.key, this._styles); | 3784 scope._styleCache.store(this.is, info, scopeData.key, this._styles); |
| 3785 } |
| 3446 if (!globalCached) { | 3786 if (!globalCached) { |
| 3447 styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._s
tyles); | 3787 styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._s
tyles); |
| 3448 } | 3788 } |
| 3449 } | 3789 } |
| 3450 }, | 3790 }, |
| 3451 _computeStyleProperties: function (scopeProps) { | 3791 _computeStyleProperties: function (scopeProps) { |
| 3452 var scope = this._findStyleHost(); | 3792 var scope = this._findStyleHost(); |
| 3453 if (!scope._styleProperties) { | 3793 if (!scope._styleProperties) { |
| 3454 scope._computeStyleProperties(); | 3794 scope._computeStyleProperties(); |
| 3455 } | 3795 } |
| 3456 var props = Object.create(scope._styleProperties); | 3796 var props = Object.create(scope._styleProperties); |
| 3457 this.mixin(props, propertyUtils.hostPropertiesFromStyles(this._styles)); | 3797 var hostAndRootProps = propertyUtils.hostAndRootPropertiesForScope(this); |
| 3798 this.mixin(props, hostAndRootProps.hostProps); |
| 3458 scopeProps = scopeProps || propertyUtils.propertyDataFromStyles(scope._styles, t
his).properties; | 3799 scopeProps = scopeProps || propertyUtils.propertyDataFromStyles(scope._styles, t
his).properties; |
| 3459 this.mixin(props, scopeProps); | 3800 this.mixin(props, scopeProps); |
| 3460 this.mixin(props, propertyUtils.scopePropertiesFromStyles(this._styles)); | 3801 this.mixin(props, hostAndRootProps.rootProps); |
| 3461 propertyUtils.mixinCustomStyle(props, this.customStyle); | 3802 propertyUtils.mixinCustomStyle(props, this.customStyle); |
| 3462 propertyUtils.reify(props); | 3803 propertyUtils.reify(props); |
| 3463 this._styleProperties = props; | 3804 this._styleProperties = props; |
| 3464 }, | 3805 }, |
| 3465 _computeOwnStyleProperties: function () { | 3806 _computeOwnStyleProperties: function () { |
| 3466 var props = {}; | 3807 var props = {}; |
| 3467 for (var i = 0, n; i < this._ownStylePropertyNames.length; i++) { | 3808 for (var i = 0, n; i < this._ownStylePropertyNames.length; i++) { |
| 3468 n = this._ownStylePropertyNames[i]; | 3809 n = this._ownStylePropertyNames[i]; |
| 3469 props[n] = this._styleProperties[n]; | 3810 props[n] = this._styleProperties[n]; |
| 3470 } | 3811 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3491 node = this.shadyRoot && this.shadyRoot._hasDistributed ? Polymer.dom(node) : no
de; | 3832 node = this.shadyRoot && this.shadyRoot._hasDistributed ? Polymer.dom(node) : no
de; |
| 3492 serializeValueToAttribute.call(this, value, attribute, node); | 3833 serializeValueToAttribute.call(this, value, attribute, node); |
| 3493 }, | 3834 }, |
| 3494 _scopeElementClass: function (element, selector) { | 3835 _scopeElementClass: function (element, selector) { |
| 3495 if (!nativeShadow && !this._scopeCssViaAttr) { | 3836 if (!nativeShadow && !this._scopeCssViaAttr) { |
| 3496 selector = (selector ? selector + ' ' : '') + SCOPE_NAME + ' ' + this.is + (elem
ent._scopeSelector ? ' ' + XSCOPE_NAME + ' ' + element._scopeSelector : ''); | 3837 selector = (selector ? selector + ' ' : '') + SCOPE_NAME + ' ' + this.is + (elem
ent._scopeSelector ? ' ' + XSCOPE_NAME + ' ' + element._scopeSelector : ''); |
| 3497 } | 3838 } |
| 3498 return selector; | 3839 return selector; |
| 3499 }, | 3840 }, |
| 3500 updateStyles: function (properties) { | 3841 updateStyles: function (properties) { |
| 3501 if (this.isAttached) { | |
| 3502 if (properties) { | 3842 if (properties) { |
| 3503 this.mixin(this.customStyle, properties); | 3843 this.mixin(this.customStyle, properties); |
| 3504 } | 3844 } |
| 3845 if (nativeVariables) { |
| 3846 propertyUtils.updateNativeStyleProperties(this, this.customStyle); |
| 3847 } else { |
| 3848 if (this.isAttached) { |
| 3505 if (this._needsStyleProperties()) { | 3849 if (this._needsStyleProperties()) { |
| 3506 this._updateStyleProperties(); | 3850 this._updateStyleProperties(); |
| 3507 } else { | 3851 } else { |
| 3508 this._styleProperties = null; | 3852 this._styleProperties = null; |
| 3509 } | 3853 } |
| 3854 } else { |
| 3855 this.__stylePropertiesInvalid = true; |
| 3856 } |
| 3510 if (this._styleCache) { | 3857 if (this._styleCache) { |
| 3511 this._styleCache.clear(); | 3858 this._styleCache.clear(); |
| 3512 } | 3859 } |
| 3513 this._updateRootStyles(); | 3860 this._updateRootStyles(); |
| 3514 } | 3861 } |
| 3515 }, | 3862 }, |
| 3516 _updateRootStyles: function (root) { | 3863 _updateRootStyles: function (root) { |
| 3517 root = root || this.root; | 3864 root = root || this.root; |
| 3518 var c$ = Polymer.dom(root)._query(function (e) { | 3865 var c$ = Polymer.dom(root)._query(function (e) { |
| 3519 return e.shadyRoot || e.shadowRoot; | 3866 return e.shadyRoot || e.shadowRoot; |
| 3520 }); | 3867 }); |
| 3521 for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) { | 3868 for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) { |
| 3522 if (c.updateStyles) { | 3869 if (c.updateStyles) { |
| 3523 c.updateStyles(); | 3870 c.updateStyles(); |
| 3524 } | 3871 } |
| 3525 } | 3872 } |
| 3526 } | 3873 } |
| 3527 }); | 3874 }); |
| 3528 Polymer.updateStyles = function (properties) { | 3875 Polymer.updateStyles = function (properties) { |
| 3529 styleDefaults.updateStyles(properties); | 3876 styleDefaults.updateStyles(properties); |
| 3530 Polymer.Base._updateRootStyles(document); | 3877 Polymer.Base._updateRootStyles(document); |
| 3531 }; | 3878 }; |
| 3532 var styleCache = new Polymer.StyleCache(); | 3879 var styleCache = new Polymer.StyleCache(); |
| 3533 Polymer.customStyleCache = styleCache; | 3880 Polymer.customStyleCache = styleCache; |
| 3534 var SCOPE_NAME = styleTransformer.SCOPE_NAME; | 3881 var SCOPE_NAME = styleTransformer.SCOPE_NAME; |
| 3535 var XSCOPE_NAME = propertyUtils.XSCOPE_NAME; | 3882 var XSCOPE_NAME = propertyUtils.XSCOPE_NAME; |
| 3536 }()); | 3883 }());Polymer.Base._addFeature({ |
| 3537 Polymer.Base._addFeature({ | |
| 3538 _registerFeatures: function () { | 3884 _registerFeatures: function () { |
| 3539 this._prepIs(); | 3885 this._prepIs(); |
| 3540 this._prepConstructor(); | 3886 this._prepConstructor(); |
| 3541 this._prepStyles(); | 3887 this._prepStyles(); |
| 3542 }, | 3888 }, |
| 3543 _finishRegisterFeatures: function () { | 3889 _finishRegisterFeatures: function () { |
| 3544 this._prepTemplate(); | 3890 this._prepTemplate(); |
| 3545 this._prepShimStyles(); | 3891 this._prepShimStyles(); |
| 3546 this._prepAnnotations(); | 3892 this._prepAnnotations(); |
| 3547 this._prepEffects(); | 3893 this._prepEffects(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3573 this._marshalBehaviors(); | 3919 this._marshalBehaviors(); |
| 3574 this._marshalHostAttributes(); | 3920 this._marshalHostAttributes(); |
| 3575 this._marshalAttributes(); | 3921 this._marshalAttributes(); |
| 3576 this._tryReady(); | 3922 this._tryReady(); |
| 3577 }, | 3923 }, |
| 3578 _marshalBehavior: function (b) { | 3924 _marshalBehavior: function (b) { |
| 3579 if (b.listeners) { | 3925 if (b.listeners) { |
| 3580 this._listenListeners(b.listeners); | 3926 this._listenListeners(b.listeners); |
| 3581 } | 3927 } |
| 3582 } | 3928 } |
| 3583 }); | 3929 });(function () { |
| 3584 (function () { | |
| 3585 var propertyUtils = Polymer.StyleProperties; | 3930 var propertyUtils = Polymer.StyleProperties; |
| 3586 var styleUtil = Polymer.StyleUtil; | 3931 var styleUtil = Polymer.StyleUtil; |
| 3587 var cssParse = Polymer.CssParse; | 3932 var cssParse = Polymer.CssParse; |
| 3588 var styleDefaults = Polymer.StyleDefaults; | 3933 var styleDefaults = Polymer.StyleDefaults; |
| 3589 var styleTransformer = Polymer.StyleTransformer; | 3934 var styleTransformer = Polymer.StyleTransformer; |
| 3935 var applyShim = Polymer.ApplyShim; |
| 3936 var debounce = Polymer.Debounce; |
| 3937 var settings = Polymer.Settings; |
| 3938 var updateDebouncer; |
| 3590 Polymer({ | 3939 Polymer({ |
| 3591 is: 'custom-style', | 3940 is: 'custom-style', |
| 3592 extends: 'style', | 3941 extends: 'style', |
| 3593 _template: null, | 3942 _template: null, |
| 3594 properties: { include: String }, | 3943 properties: { include: String }, |
| 3595 ready: function () { | 3944 ready: function () { |
| 3945 this.__appliedElement = this.__appliedElement || this; |
| 3946 this.__cssBuild = styleUtil.getCssBuildType(this); |
| 3947 if (this.__appliedElement !== this) { |
| 3948 this.__appliedElement.__cssBuild = this.__cssBuild; |
| 3949 } |
| 3596 this._tryApply(); | 3950 this._tryApply(); |
| 3597 }, | 3951 }, |
| 3598 attached: function () { | 3952 attached: function () { |
| 3599 this._tryApply(); | 3953 this._tryApply(); |
| 3600 }, | 3954 }, |
| 3601 _tryApply: function () { | 3955 _tryApply: function () { |
| 3602 if (!this._appliesToDocument) { | 3956 if (!this._appliesToDocument) { |
| 3603 if (this.parentNode && this.parentNode.localName !== 'dom-module') { | 3957 if (this.parentNode && this.parentNode.localName !== 'dom-module') { |
| 3604 this._appliesToDocument = true; | 3958 this._appliesToDocument = true; |
| 3605 var e = this.__appliedElement || this; | 3959 var e = this.__appliedElement; |
| 3960 if (!settings.useNativeCSSProperties) { |
| 3961 this.__needsUpdateStyles = styleDefaults.hasStyleProperties(); |
| 3606 styleDefaults.addStyle(e); | 3962 styleDefaults.addStyle(e); |
| 3963 } |
| 3607 if (e.textContent || this.include) { | 3964 if (e.textContent || this.include) { |
| 3608 this._apply(true); | 3965 this._apply(true); |
| 3609 } else { | 3966 } else { |
| 3610 var self = this; | 3967 var self = this; |
| 3611 var observer = new MutationObserver(function () { | 3968 var observer = new MutationObserver(function () { |
| 3612 observer.disconnect(); | 3969 observer.disconnect(); |
| 3613 self._apply(true); | 3970 self._apply(true); |
| 3614 }); | 3971 }); |
| 3615 observer.observe(e, { childList: true }); | 3972 observer.observe(e, { childList: true }); |
| 3616 } | 3973 } |
| 3617 } | 3974 } |
| 3618 } | 3975 } |
| 3619 }, | 3976 }, |
| 3620 _apply: function (deferProperties) { | 3977 _updateStyles: function () { |
| 3621 var e = this.__appliedElement || this; | 3978 Polymer.updateStyles(); |
| 3979 }, |
| 3980 _apply: function (initialApply) { |
| 3981 var e = this.__appliedElement; |
| 3622 if (this.include) { | 3982 if (this.include) { |
| 3623 e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent; | 3983 e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent; |
| 3624 } | 3984 } |
| 3625 if (e.textContent) { | 3985 if (!e.textContent) { |
| 3626 styleUtil.forEachRule(styleUtil.rulesForStyle(e), function (rule) { | 3986 return; |
| 3987 } |
| 3988 var buildType = this.__cssBuild; |
| 3989 var targetedBuild = styleUtil.isTargetedBuild(buildType); |
| 3990 if (settings.useNativeCSSProperties && targetedBuild) { |
| 3991 return; |
| 3992 } |
| 3993 var styleRules = styleUtil.rulesForStyle(e); |
| 3994 if (!targetedBuild) { |
| 3995 styleUtil.forEachRule(styleRules, function (rule) { |
| 3627 styleTransformer.documentRule(rule); | 3996 styleTransformer.documentRule(rule); |
| 3997 if (settings.useNativeCSSProperties && !buildType) { |
| 3998 applyShim.transformRule(rule); |
| 3999 } |
| 3628 }); | 4000 }); |
| 4001 } |
| 4002 if (settings.useNativeCSSProperties) { |
| 4003 e.textContent = styleUtil.toCssText(styleRules); |
| 4004 } else { |
| 3629 var self = this; | 4005 var self = this; |
| 3630 var fn = function fn() { | 4006 var fn = function fn() { |
| 3631 self._applyCustomProperties(e); | 4007 self._flushCustomProperties(); |
| 3632 }; | 4008 }; |
| 3633 if (this._pendingApplyProperties) { | 4009 if (initialApply) { |
| 3634 cancelAnimationFrame(this._pendingApplyProperties); | 4010 Polymer.RenderStatus.whenReady(fn); |
| 3635 this._pendingApplyProperties = null; | |
| 3636 } | |
| 3637 if (deferProperties) { | |
| 3638 this._pendingApplyProperties = requestAnimationFrame(fn); | |
| 3639 } else { | 4011 } else { |
| 3640 fn(); | 4012 fn(); |
| 3641 } | 4013 } |
| 3642 } | 4014 } |
| 3643 }, | 4015 }, |
| 3644 _applyCustomProperties: function (element) { | 4016 _flushCustomProperties: function () { |
| 4017 if (this.__needsUpdateStyles) { |
| 4018 this.__needsUpdateStyles = false; |
| 4019 updateDebouncer = debounce(updateDebouncer, this._updateStyles); |
| 4020 } else { |
| 4021 this._applyCustomProperties(); |
| 4022 } |
| 4023 }, |
| 4024 _applyCustomProperties: function () { |
| 4025 var element = this.__appliedElement; |
| 3645 this._computeStyleProperties(); | 4026 this._computeStyleProperties(); |
| 3646 var props = this._styleProperties; | 4027 var props = this._styleProperties; |
| 3647 var rules = styleUtil.rulesForStyle(element); | 4028 var rules = styleUtil.rulesForStyle(element); |
| 4029 if (!rules) { |
| 4030 return; |
| 4031 } |
| 3648 element.textContent = styleUtil.toCssText(rules, function (rule) { | 4032 element.textContent = styleUtil.toCssText(rules, function (rule) { |
| 3649 var css = rule.cssText = rule.parsedCssText; | 4033 var css = rule.cssText = rule.parsedCssText; |
| 3650 if (rule.propertyInfo && rule.propertyInfo.cssText) { | 4034 if (rule.propertyInfo && rule.propertyInfo.cssText) { |
| 3651 css = cssParse.removeCustomPropAssignment(css); | 4035 css = cssParse.removeCustomPropAssignment(css); |
| 3652 rule.cssText = propertyUtils.valueForProperties(css, props); | 4036 rule.cssText = propertyUtils.valueForProperties(css, props); |
| 3653 } | 4037 } |
| 3654 }); | 4038 }); |
| 3655 } | 4039 } |
| 3656 }); | 4040 }); |
| 3657 }()); | 4041 }());Polymer.Templatizer = { |
| 3658 Polymer.Templatizer = { | |
| 3659 properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } }, | 4042 properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } }, |
| 3660 _instanceProps: Polymer.nob, | 4043 _instanceProps: Polymer.nob, |
| 3661 _parentPropPrefix: '_parent_', | 4044 _parentPropPrefix: '_parent_', |
| 3662 templatize: function (template) { | 4045 templatize: function (template) { |
| 3663 this._templatized = template; | 4046 this._templatized = template; |
| 3664 if (!template._content) { | 4047 if (!template._content) { |
| 3665 template._content = template.content; | 4048 template._content = template.content; |
| 3666 } | 4049 } |
| 3667 if (template._content._ctor) { | 4050 if (template._content._ctor) { |
| 3668 this.ctor = template._content._ctor; | 4051 this.ctor = template._content._ctor; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3838 _forwardInstancePath: function (inst, path, value) { | 4221 _forwardInstancePath: function (inst, path, value) { |
| 3839 }, | 4222 }, |
| 3840 _forwardInstanceProp: function (inst, prop, value) { | 4223 _forwardInstanceProp: function (inst, prop, value) { |
| 3841 }, | 4224 }, |
| 3842 _notifyPathUpImpl: function (path, value) { | 4225 _notifyPathUpImpl: function (path, value) { |
| 3843 var dataHost = this.dataHost; | 4226 var dataHost = this.dataHost; |
| 3844 var dot = path.indexOf('.'); | 4227 var dot = path.indexOf('.'); |
| 3845 var root = dot < 0 ? path : path.slice(0, dot); | 4228 var root = dot < 0 ? path : path.slice(0, dot); |
| 3846 dataHost._forwardInstancePath.call(dataHost, this, path, value); | 4229 dataHost._forwardInstancePath.call(dataHost, this, path, value); |
| 3847 if (root in dataHost._parentProps) { | 4230 if (root in dataHost._parentProps) { |
| 3848 dataHost._templatized.notifyPath(dataHost._parentPropPrefix + path, value); | 4231 dataHost._templatized._notifyPath(dataHost._parentPropPrefix + path, value); |
| 3849 } | 4232 } |
| 3850 }, | 4233 }, |
| 3851 _pathEffectorImpl: function (path, value, fromAbove) { | 4234 _pathEffectorImpl: function (path, value, fromAbove) { |
| 3852 if (this._forwardParentPath) { | 4235 if (this._forwardParentPath) { |
| 3853 if (path.indexOf(this._parentPropPrefix) === 0) { | 4236 if (path.indexOf(this._parentPropPrefix) === 0) { |
| 3854 var subPath = path.substring(this._parentPropPrefix.length); | 4237 var subPath = path.substring(this._parentPropPrefix.length); |
| 3855 var model = this._modelForPath(subPath); | 4238 var model = this._modelForPath(subPath); |
| 3856 if (model in this._parentProps) { | 4239 if (model in this._parentProps) { |
| 3857 this._forwardParentPath(subPath, value); | 4240 this._forwardParentPath(subPath, value); |
| 3858 } | 4241 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3891 e.model = model; | 4274 e.model = model; |
| 3892 handler(e); | 4275 handler(e); |
| 3893 }; | 4276 }; |
| 3894 host._listen(node, eventName, decorated); | 4277 host._listen(node, eventName, decorated); |
| 3895 }, | 4278 }, |
| 3896 _scopeElementClassImpl: function (node, value) { | 4279 _scopeElementClassImpl: function (node, value) { |
| 3897 var host = this._rootDataHost; | 4280 var host = this._rootDataHost; |
| 3898 if (host) { | 4281 if (host) { |
| 3899 return host._scopeElementClass(node, value); | 4282 return host._scopeElementClass(node, value); |
| 3900 } | 4283 } |
| 4284 return value; |
| 3901 }, | 4285 }, |
| 3902 stamp: function (model) { | 4286 stamp: function (model) { |
| 3903 model = model || {}; | 4287 model = model || {}; |
| 3904 if (this._parentProps) { | 4288 if (this._parentProps) { |
| 3905 var templatized = this._templatized; | 4289 var templatized = this._templatized; |
| 3906 for (var prop in this._parentProps) { | 4290 for (var prop in this._parentProps) { |
| 3907 if (model[prop] === undefined) { | 4291 if (model[prop] === undefined) { |
| 3908 model[prop] = templatized[this._parentPropPrefix + prop]; | 4292 model[prop] = templatized[this._parentPropPrefix + prop]; |
| 3909 } | 4293 } |
| 3910 } | 4294 } |
| 3911 } | 4295 } |
| 3912 return new this.ctor(model, this); | 4296 return new this.ctor(model, this); |
| 3913 }, | 4297 }, |
| 3914 modelForElement: function (el) { | 4298 modelForElement: function (el) { |
| 3915 var model; | 4299 var model; |
| 3916 while (el) { | 4300 while (el) { |
| 3917 if (model = el._templateInstance) { | 4301 if (model = el._templateInstance) { |
| 3918 if (model.dataHost != this) { | 4302 if (model.dataHost != this) { |
| 3919 el = model.dataHost; | 4303 el = model.dataHost; |
| 3920 } else { | 4304 } else { |
| 3921 return model; | 4305 return model; |
| 3922 } | 4306 } |
| 3923 } else { | 4307 } else { |
| 3924 el = el.parentNode; | 4308 el = el.parentNode; |
| 3925 } | 4309 } |
| 3926 } | 4310 } |
| 3927 } | 4311 } |
| 3928 }; | 4312 };Polymer({ |
| 3929 Polymer({ | |
| 3930 is: 'dom-template', | 4313 is: 'dom-template', |
| 3931 extends: 'template', | 4314 extends: 'template', |
| 3932 _template: null, | 4315 _template: null, |
| 3933 behaviors: [Polymer.Templatizer], | 4316 behaviors: [Polymer.Templatizer], |
| 3934 ready: function () { | 4317 ready: function () { |
| 3935 this.templatize(this); | 4318 this.templatize(this); |
| 3936 } | 4319 } |
| 3937 }); | 4320 });Polymer._collections = new WeakMap(); |
| 3938 Polymer._collections = new WeakMap(); | |
| 3939 Polymer.Collection = function (userArray) { | 4321 Polymer.Collection = function (userArray) { |
| 3940 Polymer._collections.set(userArray, this); | 4322 Polymer._collections.set(userArray, this); |
| 3941 this.userArray = userArray; | 4323 this.userArray = userArray; |
| 3942 this.store = userArray.slice(); | 4324 this.store = userArray.slice(); |
| 3943 this.initMap(); | 4325 this.initMap(); |
| 3944 }; | 4326 }; |
| 3945 Polymer.Collection.prototype = { | 4327 Polymer.Collection.prototype = { |
| 3946 constructor: Polymer.Collection, | 4328 constructor: Polymer.Collection, |
| 3947 initMap: function () { | 4329 initMap: function () { |
| 3948 var omap = this.omap = new WeakMap(); | 4330 var omap = this.omap = new WeakMap(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4063 added: added | 4445 added: added |
| 4064 }]; | 4446 }]; |
| 4065 } | 4447 } |
| 4066 }; | 4448 }; |
| 4067 Polymer.Collection.get = function (userArray) { | 4449 Polymer.Collection.get = function (userArray) { |
| 4068 return Polymer._collections.get(userArray) || new Polymer.Collection(userArray); | 4450 return Polymer._collections.get(userArray) || new Polymer.Collection(userArray); |
| 4069 }; | 4451 }; |
| 4070 Polymer.Collection.applySplices = function (userArray, splices) { | 4452 Polymer.Collection.applySplices = function (userArray, splices) { |
| 4071 var coll = Polymer._collections.get(userArray); | 4453 var coll = Polymer._collections.get(userArray); |
| 4072 return coll ? coll._applySplices(splices) : null; | 4454 return coll ? coll._applySplices(splices) : null; |
| 4073 }; | 4455 };Polymer({ |
| 4074 Polymer({ | |
| 4075 is: 'dom-repeat', | 4456 is: 'dom-repeat', |
| 4076 extends: 'template', | 4457 extends: 'template', |
| 4077 _template: null, | 4458 _template: null, |
| 4078 properties: { | 4459 properties: { |
| 4079 items: { type: Array }, | 4460 items: { type: Array }, |
| 4080 as: { | 4461 as: { |
| 4081 type: String, | 4462 type: String, |
| 4082 value: 'item' | 4463 value: 'item' |
| 4083 }, | 4464 }, |
| 4084 indexAs: { | 4465 indexAs: { |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 return instance && instance[this.as]; | 4911 return instance && instance[this.as]; |
| 4531 }, | 4912 }, |
| 4532 keyForElement: function (el) { | 4913 keyForElement: function (el) { |
| 4533 var instance = this.modelForElement(el); | 4914 var instance = this.modelForElement(el); |
| 4534 return instance && instance.__key__; | 4915 return instance && instance.__key__; |
| 4535 }, | 4916 }, |
| 4536 indexForElement: function (el) { | 4917 indexForElement: function (el) { |
| 4537 var instance = this.modelForElement(el); | 4918 var instance = this.modelForElement(el); |
| 4538 return instance && instance[this.indexAs]; | 4919 return instance && instance[this.indexAs]; |
| 4539 } | 4920 } |
| 4540 }); | 4921 });Polymer({ |
| 4541 Polymer({ | |
| 4542 is: 'array-selector', | 4922 is: 'array-selector', |
| 4543 _template: null, | 4923 _template: null, |
| 4544 properties: { | 4924 properties: { |
| 4545 items: { | 4925 items: { |
| 4546 type: Array, | 4926 type: Array, |
| 4547 observer: 'clearSelection' | 4927 observer: 'clearSelection' |
| 4548 }, | 4928 }, |
| 4549 multi: { | 4929 multi: { |
| 4550 type: Boolean, | 4930 type: Boolean, |
| 4551 value: false, | 4931 value: false, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4622 if (this.toggle && item == this.selected) { | 5002 if (this.toggle && item == this.selected) { |
| 4623 this.deselect(); | 5003 this.deselect(); |
| 4624 } else { | 5004 } else { |
| 4625 this.selected = item; | 5005 this.selected = item; |
| 4626 this.selectedItem = item; | 5006 this.selectedItem = item; |
| 4627 this.linkPaths('selected', 'items.' + key); | 5007 this.linkPaths('selected', 'items.' + key); |
| 4628 this.linkPaths('selectedItem', 'items.' + key); | 5008 this.linkPaths('selectedItem', 'items.' + key); |
| 4629 } | 5009 } |
| 4630 } | 5010 } |
| 4631 } | 5011 } |
| 4632 }); | 5012 });Polymer({ |
| 4633 Polymer({ | |
| 4634 is: 'dom-if', | 5013 is: 'dom-if', |
| 4635 extends: 'template', | 5014 extends: 'template', |
| 4636 _template: null, | 5015 _template: null, |
| 4637 properties: { | 5016 properties: { |
| 4638 'if': { | 5017 'if': { |
| 4639 type: Boolean, | 5018 type: Boolean, |
| 4640 value: false, | 5019 value: false, |
| 4641 observer: '_queueRender' | 5020 observer: '_queueRender' |
| 4642 }, | 5021 }, |
| 4643 restamp: { | 5022 restamp: { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4723 _forwardParentProp: function (prop, value) { | 5102 _forwardParentProp: function (prop, value) { |
| 4724 if (this._instance) { | 5103 if (this._instance) { |
| 4725 this._instance[prop] = value; | 5104 this._instance[prop] = value; |
| 4726 } | 5105 } |
| 4727 }, | 5106 }, |
| 4728 _forwardParentPath: function (path, value) { | 5107 _forwardParentPath: function (path, value) { |
| 4729 if (this._instance) { | 5108 if (this._instance) { |
| 4730 this._instance._notifyPath(path, value, true); | 5109 this._instance._notifyPath(path, value, true); |
| 4731 } | 5110 } |
| 4732 } | 5111 } |
| 4733 }); | 5112 });Polymer({ |
| 4734 Polymer({ | |
| 4735 is: 'dom-bind', | 5113 is: 'dom-bind', |
| 4736 extends: 'template', | 5114 extends: 'template', |
| 4737 _template: null, | 5115 _template: null, |
| 4738 created: function () { | 5116 created: function () { |
| 4739 var self = this; | 5117 var self = this; |
| 4740 Polymer.RenderStatus.whenReady(function () { | 5118 Polymer.RenderStatus.whenReady(function () { |
| 4741 if (document.readyState == 'loading') { | 5119 if (document.readyState == 'loading') { |
| 4742 document.addEventListener('DOMContentLoaded', function () { | 5120 document.addEventListener('DOMContentLoaded', function () { |
| 4743 self._markImportsReady(); | 5121 self._markImportsReady(); |
| 4744 }); | 5122 }); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4807 this._prepConfigure(); | 5185 this._prepConfigure(); |
| 4808 this._prepBindings(); | 5186 this._prepBindings(); |
| 4809 this._prepPropertyInfo(); | 5187 this._prepPropertyInfo(); |
| 4810 Polymer.Base._initFeatures.call(this); | 5188 Polymer.Base._initFeatures.call(this); |
| 4811 this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root); | 5189 this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root); |
| 4812 } | 5190 } |
| 4813 this._insertChildren(); | 5191 this._insertChildren(); |
| 4814 this.fire('dom-change'); | 5192 this.fire('dom-change'); |
| 4815 } | 5193 } |
| 4816 });</script> | 5194 });</script> |
| 5195 |
| 5196 |
| 5197 |
| 5198 |
| 5199 |
| 5200 |
| 5201 |
| 5202 |
| 5203 |
| 5204 |
| 5205 |
| 5206 |
| 5207 |
| 5208 |
| 5209 |
| 5210 |
| 5211 |
| 5212 |
| 5213 |
| 5214 |
| 5215 |
| 5216 |
| 5217 |
| 5218 |
| 5219 |
| 5220 |
| 5221 |
| 5222 |
| 5223 |
| 5224 |
| 5225 |
| 5226 |
| OLD | NEW |