OLD | NEW |
1 (function () { | 1 (function () { |
2 function resolve() { | 2 function resolve() { |
3 document.body.removeAttribute('unresolved'); | 3 document.body.removeAttribute('unresolved'); |
4 } | 4 } |
5 if (window.WebComponents) { | 5 if (window.WebComponents) { |
6 addEventListener('WebComponentsReady', resolve); | 6 addEventListener('WebComponentsReady', resolve); |
7 } else { | 7 } else { |
8 if (document.readyState === 'interactive' || document.readyState === 'complete')
{ | 8 if (document.readyState === 'interactive' || document.readyState === 'complete')
{ |
9 resolve(); | 9 resolve(); |
10 } else { | 10 } else { |
(...skipping 14 matching lines...) Expand all Loading... |
25 settings.hasShadow = Boolean(Element.prototype.createShadowRoot); | 25 settings.hasShadow = Boolean(Element.prototype.createShadowRoot); |
26 settings.nativeShadow = settings.hasShadow && !window.ShadowDOMPolyfill; | 26 settings.nativeShadow = settings.hasShadow && !window.ShadowDOMPolyfill; |
27 settings.useShadow = settings.wantShadow && settings.hasShadow; | 27 settings.useShadow = settings.wantShadow && settings.hasShadow; |
28 settings.hasNativeImports = Boolean('import' in document.createElement('link')); | 28 settings.hasNativeImports = Boolean('import' in document.createElement('link')); |
29 settings.useNativeImports = settings.hasNativeImports; | 29 settings.useNativeImports = settings.hasNativeImports; |
30 settings.useNativeCustomElements = !window.CustomElements || window.CustomElemen
ts.useNative; | 30 settings.useNativeCustomElements = !window.CustomElements || window.CustomElemen
ts.useNative; |
31 settings.useNativeShadow = settings.useShadow && settings.nativeShadow; | 31 settings.useNativeShadow = settings.useShadow && settings.nativeShadow; |
32 settings.usePolyfillProto = !settings.useNativeCustomElements && !Object.__proto
__; | 32 settings.usePolyfillProto = !settings.useNativeCustomElements && !Object.__proto
__; |
33 settings.hasNativeCSSProperties = !navigator.userAgent.match('AppleWebKit/601')
&& window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'); | 33 settings.hasNativeCSSProperties = !navigator.userAgent.match('AppleWebKit/601')
&& window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'); |
34 settings.useNativeCSSProperties = settings.hasNativeCSSProperties && settings.la
zyRegister && settings.useNativeCSSProperties; | 34 settings.useNativeCSSProperties = settings.hasNativeCSSProperties && settings.la
zyRegister && settings.useNativeCSSProperties; |
| 35 settings.isIE = navigator.userAgent.match('Trident'); |
35 return settings; | 36 return settings; |
36 }() | 37 }() |
37 };(function () { | 38 };(function () { |
38 var userPolymer = window.Polymer; | 39 var userPolymer = window.Polymer; |
39 window.Polymer = function (prototype) { | 40 window.Polymer = function (prototype) { |
40 if (typeof prototype === 'function') { | 41 if (typeof prototype === 'function') { |
41 prototype = prototype.prototype; | 42 prototype = prototype.prototype; |
42 } | 43 } |
43 if (!prototype) { | 44 if (!prototype) { |
44 prototype = {}; | 45 prototype = {}; |
45 } | 46 } |
46 var factory = desugar(prototype); | 47 prototype = desugar(prototype); |
47 prototype = factory.prototype; | 48 var customCtor = prototype === prototype.constructor.prototype ? prototype.const
ructor : null; |
48 var options = { prototype: prototype }; | 49 var options = { prototype: prototype }; |
49 if (prototype.extends) { | 50 if (prototype.extends) { |
50 options.extends = prototype.extends; | 51 options.extends = prototype.extends; |
51 } | 52 } |
52 Polymer.telemetry._registrate(prototype); | 53 Polymer.telemetry._registrate(prototype); |
53 document.registerElement(prototype.is, options); | 54 var ctor = document.registerElement(prototype.is, options); |
54 return factory; | 55 return customCtor || ctor; |
55 }; | 56 }; |
56 var desugar = function (prototype) { | 57 var desugar = function (prototype) { |
57 var base = Polymer.Base; | 58 var base = Polymer.Base; |
58 if (prototype.extends) { | 59 if (prototype.extends) { |
59 base = Polymer.Base._getExtendedPrototype(prototype.extends); | 60 base = Polymer.Base._getExtendedPrototype(prototype.extends); |
60 } | 61 } |
61 prototype = Polymer.Base.chainObject(prototype, base); | 62 prototype = Polymer.Base.chainObject(prototype, base); |
62 prototype.registerCallback(); | 63 prototype.registerCallback(); |
63 return prototype.constructor; | 64 return prototype; |
64 }; | 65 }; |
65 if (userPolymer) { | 66 if (userPolymer) { |
66 for (var i in userPolymer) { | 67 for (var i in userPolymer) { |
67 Polymer[i] = userPolymer[i]; | 68 Polymer[i] = userPolymer[i]; |
68 } | 69 } |
69 } | 70 } |
70 Polymer.Class = desugar; | 71 Polymer.Class = function (prototype) { |
| 72 if (!prototype.factoryImpl) { |
| 73 prototype.factoryImpl = function () { |
| 74 }; |
| 75 } |
| 76 return desugar(prototype).constructor; |
| 77 }; |
71 }()); | 78 }()); |
72 Polymer.telemetry = { | 79 Polymer.telemetry = { |
73 registrations: [], | 80 registrations: [], |
74 _regLog: function (prototype) { | 81 _regLog: function (prototype) { |
75 console.log('[' + prototype.is + ']: registered'); | 82 console.log('[' + prototype.is + ']: registered'); |
76 }, | 83 }, |
77 _registrate: function (prototype) { | 84 _registrate: function (prototype) { |
78 this.registrations.push(prototype); | 85 this.registrations.push(prototype); |
79 Polymer.log && this._regLog(prototype); | 86 Polymer.log && this._regLog(prototype); |
80 }, | 87 }, |
81 dumpRegistrations: function () { | 88 dumpRegistrations: function () { |
82 this.registrations.forEach(this._regLog); | 89 this.registrations.forEach(this._regLog); |
83 } | 90 } |
84 };Object.defineProperty(window, 'currentImport', { | 91 };Object.defineProperty(window, 'currentImport', { |
85 enumerable: true, | 92 enumerable: true, |
86 configurable: true, | 93 configurable: true, |
87 get: function () { | 94 get: function () { |
88 return (document._currentScript || document.currentScript).ownerDocument; | 95 return (document._currentScript || document.currentScript || {}).ownerDocument; |
89 } | 96 } |
90 });Polymer.RenderStatus = { | 97 });Polymer.RenderStatus = { |
91 _ready: false, | 98 _ready: false, |
92 _callbacks: [], | 99 _callbacks: [], |
93 whenReady: function (cb) { | 100 whenReady: function (cb) { |
94 if (this._ready) { | 101 if (this._ready) { |
95 cb(); | 102 cb(); |
96 } else { | 103 } else { |
97 this._callbacks.push(cb); | 104 this._callbacks.push(cb); |
98 } | 105 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } else { | 164 } else { |
158 Polymer.RenderStatus._catchFirstRender(); | 165 Polymer.RenderStatus._catchFirstRender(); |
159 } | 166 } |
160 Polymer.ImportStatus = Polymer.RenderStatus; | 167 Polymer.ImportStatus = Polymer.RenderStatus; |
161 Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;(function () { | 168 Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;(function () { |
162 'use strict'; | 169 'use strict'; |
163 var settings = Polymer.Settings; | 170 var settings = Polymer.Settings; |
164 Polymer.Base = { | 171 Polymer.Base = { |
165 __isPolymerInstance__: true, | 172 __isPolymerInstance__: true, |
166 _addFeature: function (feature) { | 173 _addFeature: function (feature) { |
167 this.extend(this, feature); | 174 this.mixin(this, feature); |
168 }, | 175 }, |
169 registerCallback: function () { | 176 registerCallback: function () { |
170 if (settings.lazyRegister === 'max') { | 177 if (settings.lazyRegister === 'max') { |
171 if (this.beforeRegister) { | 178 if (this.beforeRegister) { |
172 this.beforeRegister(); | 179 this.beforeRegister(); |
173 } | 180 } |
174 } else { | 181 } else { |
175 this._desugarBehaviors(); | 182 this._desugarBehaviors(); |
176 this._doBehavior('beforeRegister'); | 183 for (var i = 0, b; i < this.behaviors.length; i++) { |
| 184 b = this.behaviors[i]; |
| 185 if (b.beforeRegister) { |
| 186 b.beforeRegister.call(this); |
| 187 } |
| 188 } |
| 189 if (this.beforeRegister) { |
| 190 this.beforeRegister(); |
| 191 } |
177 } | 192 } |
178 this._registerFeatures(); | 193 this._registerFeatures(); |
179 if (!settings.lazyRegister) { | 194 if (!settings.lazyRegister) { |
180 this.ensureRegisterFinished(); | 195 this.ensureRegisterFinished(); |
181 } | 196 } |
182 }, | 197 }, |
183 createdCallback: function () { | 198 createdCallback: function () { |
| 199 if (settings.disableUpgradeEnabled) { |
| 200 if (this.hasAttribute('disable-upgrade')) { |
| 201 this._propertySetter = disableUpgradePropertySetter; |
| 202 this._configValue = null; |
| 203 this.__data__ = {}; |
| 204 return; |
| 205 } else { |
| 206 this.__hasInitialized = true; |
| 207 } |
| 208 } |
| 209 this.__initialize(); |
| 210 }, |
| 211 __initialize: function () { |
184 if (!this.__hasRegisterFinished) { | 212 if (!this.__hasRegisterFinished) { |
185 this._ensureRegisterFinished(this.__proto__); | 213 this._ensureRegisterFinished(this.__proto__); |
186 } | 214 } |
187 Polymer.telemetry.instanceCount++; | 215 Polymer.telemetry.instanceCount++; |
188 this.root = this; | 216 this.root = this; |
189 this._doBehavior('created'); | 217 for (var i = 0, b; i < this.behaviors.length; i++) { |
| 218 b = this.behaviors[i]; |
| 219 if (b.created) { |
| 220 b.created.call(this); |
| 221 } |
| 222 } |
| 223 if (this.created) { |
| 224 this.created(); |
| 225 } |
190 this._initFeatures(); | 226 this._initFeatures(); |
191 }, | 227 }, |
192 ensureRegisterFinished: function () { | 228 ensureRegisterFinished: function () { |
193 this._ensureRegisterFinished(this); | 229 this._ensureRegisterFinished(this); |
194 }, | 230 }, |
195 _ensureRegisterFinished: function (proto) { | 231 _ensureRegisterFinished: function (proto) { |
196 if (proto.__hasRegisterFinished !== proto.is || !proto.is) { | 232 if (proto.__hasRegisterFinished !== proto.is || !proto.is) { |
197 if (settings.lazyRegister === 'max') { | 233 if (settings.lazyRegister === 'max') { |
198 proto._desugarBehaviors(); | 234 proto._desugarBehaviors(); |
199 proto._doBehaviorOnly('beforeRegister'); | 235 for (var i = 0, b; i < proto.behaviors.length; i++) { |
| 236 b = proto.behaviors[i]; |
| 237 if (b.beforeRegister) { |
| 238 b.beforeRegister.call(proto); |
| 239 } |
| 240 } |
200 } | 241 } |
201 proto.__hasRegisterFinished = proto.is; | 242 proto.__hasRegisterFinished = proto.is; |
202 if (proto._finishRegisterFeatures) { | 243 if (proto._finishRegisterFeatures) { |
203 proto._finishRegisterFeatures(); | 244 proto._finishRegisterFeatures(); |
204 } | 245 } |
205 proto._doBehavior('registered'); | 246 for (var j = 0, pb; j < proto.behaviors.length; j++) { |
| 247 pb = proto.behaviors[j]; |
| 248 if (pb.registered) { |
| 249 pb.registered.call(proto); |
| 250 } |
| 251 } |
| 252 if (proto.registered) { |
| 253 proto.registered(); |
| 254 } |
206 if (settings.usePolyfillProto && proto !== this) { | 255 if (settings.usePolyfillProto && proto !== this) { |
207 proto.extend(this, proto); | 256 proto.extend(this, proto); |
208 } | 257 } |
209 } | 258 } |
210 }, | 259 }, |
211 attachedCallback: function () { | 260 attachedCallback: function () { |
212 var self = this; | 261 var self = this; |
213 Polymer.RenderStatus.whenReady(function () { | 262 Polymer.RenderStatus.whenReady(function () { |
214 self.isAttached = true; | 263 self.isAttached = true; |
215 self._doBehavior('attached'); | 264 for (var i = 0, b; i < self.behaviors.length; i++) { |
| 265 b = self.behaviors[i]; |
| 266 if (b.attached) { |
| 267 b.attached.call(self); |
| 268 } |
| 269 } |
| 270 if (self.attached) { |
| 271 self.attached(); |
| 272 } |
216 }); | 273 }); |
217 }, | 274 }, |
218 detachedCallback: function () { | 275 detachedCallback: function () { |
219 var self = this; | 276 var self = this; |
220 Polymer.RenderStatus.whenReady(function () { | 277 Polymer.RenderStatus.whenReady(function () { |
221 self.isAttached = false; | 278 self.isAttached = false; |
222 self._doBehavior('detached'); | 279 for (var i = 0, b; i < self.behaviors.length; i++) { |
| 280 b = self.behaviors[i]; |
| 281 if (b.detached) { |
| 282 b.detached.call(self); |
| 283 } |
| 284 } |
| 285 if (self.detached) { |
| 286 self.detached(); |
| 287 } |
223 }); | 288 }); |
224 }, | 289 }, |
225 attributeChangedCallback: function (name, oldValue, newValue) { | 290 attributeChangedCallback: function (name, oldValue, newValue) { |
226 this._attributeChangedImpl(name); | 291 this._attributeChangedImpl(name); |
227 this._doBehavior('attributeChanged', [ | 292 for (var i = 0, b; i < this.behaviors.length; i++) { |
228 name, | 293 b = this.behaviors[i]; |
229 oldValue, | 294 if (b.attributeChanged) { |
230 newValue | 295 b.attributeChanged.call(this, name, oldValue, newValue); |
231 ]); | 296 } |
| 297 } |
| 298 if (this.attributeChanged) { |
| 299 this.attributeChanged(name, oldValue, newValue); |
| 300 } |
232 }, | 301 }, |
233 _attributeChangedImpl: function (name) { | 302 _attributeChangedImpl: function (name) { |
234 this._setAttributeToProperty(this, name); | 303 this._setAttributeToProperty(this, name); |
235 }, | 304 }, |
236 extend: function (target, source) { | 305 extend: function (target, source) { |
237 if (target && source) { | 306 if (target && source) { |
238 var n$ = Object.getOwnPropertyNames(source); | 307 var n$ = Object.getOwnPropertyNames(source); |
239 for (var i = 0, n; i < n$.length && (n = n$[i]); i++) { | 308 for (var i = 0, n; i < n$.length && (n = n$[i]); i++) { |
240 this.copyOwnProperty(n, source, target); | 309 this.copyOwnProperty(n, source, target); |
241 } | 310 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 Polymer.Base.chainObject = function (object, inherited) { | 361 Polymer.Base.chainObject = function (object, inherited) { |
293 if (object && inherited && object !== inherited) { | 362 if (object && inherited && object !== inherited) { |
294 if (!Object.__proto__) { | 363 if (!Object.__proto__) { |
295 object = Polymer.Base.extend(Object.create(inherited), object); | 364 object = Polymer.Base.extend(Object.create(inherited), object); |
296 } | 365 } |
297 object.__proto__ = inherited; | 366 object.__proto__ = inherited; |
298 } | 367 } |
299 return object; | 368 return object; |
300 }; | 369 }; |
301 Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype); | 370 Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype); |
| 371 Polymer.BaseDescriptors = {}; |
| 372 var disableUpgradePropertySetter; |
| 373 if (settings.disableUpgradeEnabled) { |
| 374 disableUpgradePropertySetter = function (property, value) { |
| 375 this.__data__[property] = value; |
| 376 }; |
| 377 var origAttributeChangedCallback = Polymer.Base.attributeChangedCallback; |
| 378 Polymer.Base.attributeChangedCallback = function (name, oldValue, newValue) { |
| 379 if (!this.__hasInitialized && name === 'disable-upgrade') { |
| 380 this.__hasInitialized = true; |
| 381 this._propertySetter = Polymer.Bind._modelApi._propertySetter; |
| 382 this._configValue = Polymer.Base._configValue; |
| 383 this.__initialize(); |
| 384 } |
| 385 origAttributeChangedCallback.call(this, name, oldValue, newValue); |
| 386 }; |
| 387 } |
302 if (window.CustomElements) { | 388 if (window.CustomElements) { |
303 Polymer.instanceof = CustomElements.instanceof; | 389 Polymer.instanceof = CustomElements.instanceof; |
304 } else { | 390 } else { |
305 Polymer.instanceof = function (obj, ctor) { | 391 Polymer.instanceof = function (obj, ctor) { |
306 return obj instanceof ctor; | 392 return obj instanceof ctor; |
307 }; | 393 }; |
308 } | 394 } |
309 Polymer.isInstance = function (obj) { | 395 Polymer.isInstance = function (obj) { |
310 return Boolean(obj && obj.__isPolymerInstance__); | 396 return Boolean(obj && obj.__isPolymerInstance__); |
311 }; | 397 }; |
312 Polymer.telemetry.instanceCount = 0; | 398 Polymer.telemetry.instanceCount = 0; |
313 }());(function () { | 399 }());(function () { |
314 var modules = {}; | 400 var modules = {}; |
315 var lcModules = {}; | 401 var lcModules = {}; |
316 var findModule = function (id) { | 402 var findModule = function (id) { |
317 return modules[id] || lcModules[id.toLowerCase()]; | 403 return modules[id] || lcModules[id.toLowerCase()]; |
318 }; | 404 }; |
319 var DomModule = function () { | 405 var DomModule = function () { |
320 return document.createElement('dom-module'); | 406 return document.createElement('dom-module'); |
321 }; | 407 }; |
322 DomModule.prototype = Object.create(HTMLElement.prototype); | 408 DomModule.prototype = Object.create(HTMLElement.prototype); |
323 Polymer.Base.extend(DomModule.prototype, { | 409 Polymer.Base.mixin(DomModule.prototype, { |
324 constructor: DomModule, | |
325 createdCallback: function () { | 410 createdCallback: function () { |
326 this.register(); | 411 this.register(); |
327 }, | 412 }, |
328 register: function (id) { | 413 register: function (id) { |
329 id = id || this.id || this.getAttribute('name') || this.getAttribute('is'); | 414 id = id || this.id || this.getAttribute('name') || this.getAttribute('is'); |
330 if (id) { | 415 if (id) { |
331 this.id = id; | 416 this.id = id; |
332 modules[id] = this; | 417 modules[id] = this; |
333 lcModules[id.toLowerCase()] = this; | 418 lcModules[id.toLowerCase()] = this; |
334 } | 419 } |
335 }, | 420 }, |
336 import: function (id, selector) { | 421 import: function (id, selector) { |
337 if (id) { | 422 if (id) { |
338 var m = findModule(id); | 423 var m = findModule(id); |
339 if (!m) { | 424 if (!m) { |
340 forceDomModulesUpgrade(); | 425 forceDomModulesUpgrade(); |
341 m = findModule(id); | 426 m = findModule(id); |
342 } | 427 } |
343 if (m && selector) { | 428 if (m && selector) { |
344 m = m.querySelector(selector); | 429 m = m.querySelector(selector); |
345 } | 430 } |
346 return m; | 431 return m; |
347 } | 432 } |
348 } | 433 } |
349 }); | 434 }); |
| 435 Object.defineProperty(DomModule.prototype, 'constructor', { |
| 436 value: DomModule, |
| 437 configurable: true, |
| 438 writable: true |
| 439 }); |
350 var cePolyfill = window.CustomElements && !CustomElements.useNative; | 440 var cePolyfill = window.CustomElements && !CustomElements.useNative; |
351 document.registerElement('dom-module', DomModule); | 441 document.registerElement('dom-module', DomModule); |
352 function forceDomModulesUpgrade() { | 442 function forceDomModulesUpgrade() { |
353 if (cePolyfill) { | 443 if (cePolyfill) { |
354 var script = document._currentScript || document.currentScript; | 444 var script = document._currentScript || document.currentScript; |
355 var doc = script && script.ownerDocument || document; | 445 var doc = script && script.ownerDocument || document; |
356 var modules = doc.querySelectorAll('dom-module'); | 446 var modules = doc.querySelectorAll('dom-module'); |
357 for (var i = modules.length - 1, m; i >= 0 && (m = modules[i]); i--) { | 447 for (var i = modules.length - 1, m; i >= 0 && (m = modules[i]); i--) { |
358 if (m.__upgraded__) { | 448 if (m.__upgraded__) { |
359 return; | 449 return; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } else if (b) { | 494 } else if (b) { |
405 flat.push(b); | 495 flat.push(b); |
406 } else { | 496 } else { |
407 this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for miss
ing or 404 import')); | 497 this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for miss
ing or 404 import')); |
408 } | 498 } |
409 } | 499 } |
410 return flat; | 500 return flat; |
411 }, | 501 }, |
412 _mixinBehavior: function (b) { | 502 _mixinBehavior: function (b) { |
413 var n$ = Object.getOwnPropertyNames(b); | 503 var n$ = Object.getOwnPropertyNames(b); |
| 504 var useAssignment = b._noAccessors; |
414 for (var i = 0, n; i < n$.length && (n = n$[i]); i++) { | 505 for (var i = 0, n; i < n$.length && (n = n$[i]); i++) { |
415 if (!Polymer.Base._behaviorProperties[n] && !this.hasOwnProperty(n)) { | 506 if (!Polymer.Base._behaviorProperties[n] && !this.hasOwnProperty(n)) { |
| 507 if (useAssignment) { |
| 508 this[n] = b[n]; |
| 509 } else { |
416 this.copyOwnProperty(n, b, this); | 510 this.copyOwnProperty(n, b, this); |
417 } | 511 } |
418 } | 512 } |
| 513 } |
419 }, | 514 }, |
420 _prepBehaviors: function () { | 515 _prepBehaviors: function () { |
421 this._prepFlattenedBehaviors(this.behaviors); | 516 this._prepFlattenedBehaviors(this.behaviors); |
422 }, | 517 }, |
423 _prepFlattenedBehaviors: function (behaviors) { | 518 _prepFlattenedBehaviors: function (behaviors) { |
424 for (var i = 0, l = behaviors.length; i < l; i++) { | 519 for (var i = 0, l = behaviors.length; i < l; i++) { |
425 this._prepBehavior(behaviors[i]); | 520 this._prepBehavior(behaviors[i]); |
426 } | 521 } |
427 this._prepBehavior(this); | 522 this._prepBehavior(this); |
428 }, | 523 }, |
429 _doBehavior: function (name, args) { | |
430 for (var i = 0; i < this.behaviors.length; i++) { | |
431 this._invokeBehavior(this.behaviors[i], name, args); | |
432 } | |
433 this._invokeBehavior(this, name, args); | |
434 }, | |
435 _doBehaviorOnly: function (name, args) { | |
436 for (var i = 0; i < this.behaviors.length; i++) { | |
437 this._invokeBehavior(this.behaviors[i], name, args); | |
438 } | |
439 }, | |
440 _invokeBehavior: function (b, name, args) { | |
441 var fn = b[name]; | |
442 if (fn) { | |
443 fn.apply(this, args || Polymer.nar); | |
444 } | |
445 }, | |
446 _marshalBehaviors: function () { | 524 _marshalBehaviors: function () { |
447 for (var i = 0; i < this.behaviors.length; i++) { | 525 for (var i = 0; i < this.behaviors.length; i++) { |
448 this._marshalBehavior(this.behaviors[i]); | 526 this._marshalBehavior(this.behaviors[i]); |
449 } | 527 } |
450 this._marshalBehavior(this); | 528 this._marshalBehavior(this); |
451 } | 529 } |
452 }); | 530 }); |
453 Polymer.Base._behaviorProperties = { | 531 Polymer.Base._behaviorProperties = { |
454 hostAttributes: true, | 532 hostAttributes: true, |
455 beforeRegister: true, | 533 beforeRegister: true, |
456 registered: true, | 534 registered: true, |
457 properties: true, | 535 properties: true, |
458 observers: true, | 536 observers: true, |
459 listeners: true, | 537 listeners: true, |
460 created: true, | 538 created: true, |
461 attached: true, | 539 attached: true, |
462 detached: true, | 540 detached: true, |
463 attributeChanged: true, | 541 attributeChanged: true, |
464 ready: true | 542 ready: true, |
| 543 _noAccessors: true |
465 };Polymer.Base._addFeature({ | 544 };Polymer.Base._addFeature({ |
466 _getExtendedPrototype: function (tag) { | 545 _getExtendedPrototype: function (tag) { |
467 return this._getExtendedNativePrototype(tag); | 546 return this._getExtendedNativePrototype(tag); |
468 }, | 547 }, |
469 _nativePrototypes: {}, | 548 _nativePrototypes: {}, |
470 _getExtendedNativePrototype: function (tag) { | 549 _getExtendedNativePrototype: function (tag) { |
471 var p = this._nativePrototypes[tag]; | 550 var p = this._nativePrototypes[tag]; |
472 if (!p) { | 551 if (!p) { |
473 var np = this.getNativePrototype(tag); | 552 p = Object.create(this.getNativePrototype(tag)); |
474 p = this.extend(Object.create(np), Polymer.Base); | 553 var p$ = Object.getOwnPropertyNames(Polymer.Base); |
| 554 for (var i = 0, n; i < p$.length && (n = p$[i]); i++) { |
| 555 if (!Polymer.BaseDescriptors[n]) { |
| 556 p[n] = Polymer.Base[n]; |
| 557 } |
| 558 } |
| 559 Object.defineProperties(p, Polymer.BaseDescriptors); |
475 this._nativePrototypes[tag] = p; | 560 this._nativePrototypes[tag] = p; |
476 } | 561 } |
477 return p; | 562 return p; |
478 }, | 563 }, |
479 getNativePrototype: function (tag) { | 564 getNativePrototype: function (tag) { |
480 return Object.getPrototypeOf(document.createElement(tag)); | 565 return Object.getPrototypeOf(document.createElement(tag)); |
481 } | 566 } |
482 });Polymer.Base._addFeature({ | 567 });Polymer.Base._addFeature({ |
483 _prepConstructor: function () { | 568 _prepConstructor: function () { |
484 this._factoryArgs = this.extends ? [ | 569 this._factoryArgs = this.extends ? [ |
(...skipping 15 matching lines...) Expand all Loading... |
500 }, | 585 }, |
501 _factory: function (args) { | 586 _factory: function (args) { |
502 var elt = document.createElement.apply(document, this._factoryArgs); | 587 var elt = document.createElement.apply(document, this._factoryArgs); |
503 if (this.factoryImpl) { | 588 if (this.factoryImpl) { |
504 this.factoryImpl.apply(elt, args); | 589 this.factoryImpl.apply(elt, args); |
505 } | 590 } |
506 return elt; | 591 return elt; |
507 } | 592 } |
508 });Polymer.nob = Object.create(null); | 593 });Polymer.nob = Object.create(null); |
509 Polymer.Base._addFeature({ | 594 Polymer.Base._addFeature({ |
510 properties: {}, | |
511 getPropertyInfo: function (property) { | 595 getPropertyInfo: function (property) { |
512 var info = this._getPropertyInfo(property, this.properties); | 596 var info = this._getPropertyInfo(property, this.properties); |
513 if (!info) { | 597 if (!info) { |
514 for (var i = 0; i < this.behaviors.length; i++) { | 598 for (var i = 0; i < this.behaviors.length; i++) { |
515 info = this._getPropertyInfo(property, this.behaviors[i].properties); | 599 info = this._getPropertyInfo(property, this.behaviors[i].properties); |
516 if (info) { | 600 if (info) { |
517 return info; | 601 return info; |
518 } | 602 } |
519 } | 603 } |
520 } | 604 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 if (!t.type) { | 641 if (!t.type) { |
558 t.type = s.type; | 642 t.type = s.type; |
559 } | 643 } |
560 if (!t.readOnly) { | 644 if (!t.readOnly) { |
561 t.readOnly = s.readOnly; | 645 t.readOnly = s.readOnly; |
562 } | 646 } |
563 } | 647 } |
564 } | 648 } |
565 } | 649 } |
566 } | 650 } |
567 });Polymer.CaseMap = { | 651 }); |
| 652 (function () { |
| 653 var propertiesDesc = { |
| 654 configurable: true, |
| 655 writable: true, |
| 656 enumerable: true, |
| 657 value: {} |
| 658 }; |
| 659 Polymer.BaseDescriptors.properties = propertiesDesc; |
| 660 Object.defineProperty(Polymer.Base, 'properties', propertiesDesc); |
| 661 }());Polymer.CaseMap = { |
568 _caseMap: {}, | 662 _caseMap: {}, |
569 _rx: { | 663 _rx: { |
570 dashToCamel: /-[a-z]/g, | 664 dashToCamel: /-[a-z]/g, |
571 camelToDash: /([A-Z])/g | 665 camelToDash: /([A-Z])/g |
572 }, | 666 }, |
573 dashToCamelCase: function (dash) { | 667 dashToCamelCase: function (dash) { |
574 return this._caseMap[dash] || (this._caseMap[dash] = dash.indexOf('-') < 0 ? das
h : dash.replace(this._rx.dashToCamel, function (m) { | 668 return this._caseMap[dash] || (this._caseMap[dash] = dash.indexOf('-') < 0 ? das
h : dash.replace(this._rx.dashToCamel, function (m) { |
575 return m[1].toUpperCase(); | 669 return m[1].toUpperCase(); |
576 })); | 670 })); |
577 }, | 671 }, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 try { | 775 try { |
682 return JSON.stringify(value); | 776 return JSON.stringify(value); |
683 } catch (x) { | 777 } catch (x) { |
684 return ''; | 778 return ''; |
685 } | 779 } |
686 } | 780 } |
687 default: | 781 default: |
688 return value != null ? value : undefined; | 782 return value != null ? value : undefined; |
689 } | 783 } |
690 } | 784 } |
691 });Polymer.version = "1.6.1";Polymer.Base._addFeature({ | 785 });Polymer.version = "1.8.1";Polymer.Base._addFeature({ |
692 _registerFeatures: function () { | 786 _registerFeatures: function () { |
693 this._prepIs(); | 787 this._prepIs(); |
694 this._prepBehaviors(); | 788 this._prepBehaviors(); |
695 this._prepConstructor(); | 789 this._prepConstructor(); |
696 this._prepPropertyInfo(); | 790 this._prepPropertyInfo(); |
697 }, | 791 }, |
698 _prepBehavior: function (b) { | 792 _prepBehavior: function (b) { |
699 this._addHostAttributes(b.hostAttributes); | 793 this._addHostAttributes(b.hostAttributes); |
700 }, | 794 }, |
701 _marshalBehavior: function (b) { | 795 _marshalBehavior: function (b) { |
702 }, | 796 }, |
703 _initFeatures: function () { | 797 _initFeatures: function () { |
704 this._marshalHostAttributes(); | 798 this._marshalHostAttributes(); |
705 this._marshalBehaviors(); | 799 this._marshalBehaviors(); |
706 } | 800 } |
707 }); | 801 }); |
OLD | NEW |