polymer-rails 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/polymer/polymer-micro.html +528 -21
  3. data/app/assets/javascripts/polymer/polymer-mini.html +1304 -27
  4. data/app/assets/javascripts/polymer/polymer.html +3771 -51
  5. data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +44 -14
  6. data/app/assets/javascripts/webcomponentsjs/webcomponents.js +7106 -0
  7. data/lib/polymer-rails/version.rb +1 -1
  8. metadata +4 -64
  9. data/app/assets/javascripts/polymer/src/lib/annotations/annotations.html +0 -262
  10. data/app/assets/javascripts/polymer/src/lib/annotations/demo/app-chrome.html +0 -60
  11. data/app/assets/javascripts/polymer/src/lib/array-observe.html +0 -118
  12. data/app/assets/javascripts/polymer/src/lib/array-splice.html +0 -262
  13. data/app/assets/javascripts/polymer/src/lib/async.html +0 -68
  14. data/app/assets/javascripts/polymer/src/lib/base.html +0 -117
  15. data/app/assets/javascripts/polymer/src/lib/bind/accessors.html +0 -223
  16. data/app/assets/javascripts/polymer/src/lib/bind/demo/app-chrome.html +0 -28
  17. data/app/assets/javascripts/polymer/src/lib/bind/demo/app.html +0 -29
  18. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/annotations-bind-demo.html +0 -76
  19. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/bind-demo.html +0 -83
  20. data/app/assets/javascripts/polymer/src/lib/bind/effects.html +0 -80
  21. data/app/assets/javascripts/polymer/src/lib/case-map.html +0 -46
  22. data/app/assets/javascripts/polymer/src/lib/collection.html +0 -179
  23. data/app/assets/javascripts/polymer/src/lib/css-parse.html +0 -131
  24. data/app/assets/javascripts/polymer/src/lib/debounce.html +0 -69
  25. data/app/assets/javascripts/polymer/src/lib/dom-api.html +0 -467
  26. data/app/assets/javascripts/polymer/src/lib/dom-module.html +0 -68
  27. data/app/assets/javascripts/polymer/src/lib/event-api.html +0 -92
  28. data/app/assets/javascripts/polymer/src/lib/expr/focus.html +0 -22
  29. data/app/assets/javascripts/polymer/src/lib/expr/gestures.html +0 -1
  30. data/app/assets/javascripts/polymer/src/lib/expr/log.html +0 -21
  31. data/app/assets/javascripts/polymer/src/lib/expr/sinspect.html +0 -235
  32. data/app/assets/javascripts/polymer/src/lib/expr/style-auditor.html +0 -123
  33. data/app/assets/javascripts/polymer/src/lib/expr/style-protector.html +0 -52
  34. data/app/assets/javascripts/polymer/src/lib/gestures.html +0 -284
  35. data/app/assets/javascripts/polymer/src/lib/lang.html +0 -21
  36. data/app/assets/javascripts/polymer/src/lib/module.html +0 -56
  37. data/app/assets/javascripts/polymer/src/lib/polymer-bootstrap.html +0 -78
  38. data/app/assets/javascripts/polymer/src/lib/resolve-url.html +0 -82
  39. data/app/assets/javascripts/polymer/src/lib/settings.html +0 -52
  40. data/app/assets/javascripts/polymer/src/lib/style-defaults.html +0 -32
  41. data/app/assets/javascripts/polymer/src/lib/style-transformer.html +0 -185
  42. data/app/assets/javascripts/polymer/src/lib/style-util.html +0 -77
  43. data/app/assets/javascripts/polymer/src/lib/template/templatizer.html +0 -132
  44. data/app/assets/javascripts/polymer/src/lib/template/x-array-selector.html +0 -178
  45. data/app/assets/javascripts/polymer/src/lib/template/x-autobind.html +0 -80
  46. data/app/assets/javascripts/polymer/src/lib/template/x-if.html +0 -115
  47. data/app/assets/javascripts/polymer/src/lib/template/x-repeat.html +0 -510
  48. data/app/assets/javascripts/polymer/src/lib/template/x-template.html +0 -39
  49. data/app/assets/javascripts/polymer/src/lib/x-style.html +0 -115
  50. data/app/assets/javascripts/polymer/src/micro/attributes.html +0 -180
  51. data/app/assets/javascripts/polymer/src/micro/constructor.html +0 -74
  52. data/app/assets/javascripts/polymer/src/micro/extends.html +0 -79
  53. data/app/assets/javascripts/polymer/src/micro/mixins.html +0 -40
  54. data/app/assets/javascripts/polymer/src/micro/properties.html +0 -96
  55. data/app/assets/javascripts/polymer/src/micro/tag.html +0 -28
  56. data/app/assets/javascripts/polymer/src/mini/ready.html +0 -180
  57. data/app/assets/javascripts/polymer/src/mini/shadow.html +0 -41
  58. data/app/assets/javascripts/polymer/src/mini/shady.html +0 -365
  59. data/app/assets/javascripts/polymer/src/mini/template.html +0 -56
  60. data/app/assets/javascripts/polymer/src/polymer-lib.html +0 -15
  61. data/app/assets/javascripts/polymer/src/standard/annotations.html +0 -198
  62. data/app/assets/javascripts/polymer/src/standard/configure.html +0 -160
  63. data/app/assets/javascripts/polymer/src/standard/effects.html +0 -215
  64. data/app/assets/javascripts/polymer/src/standard/events.html +0 -127
  65. data/app/assets/javascripts/polymer/src/standard/notify-path.html +0 -260
  66. data/app/assets/javascripts/polymer/src/standard/resolveUrl.html +0 -27
  67. data/app/assets/javascripts/polymer/src/standard/styling.html +0 -157
  68. data/app/assets/javascripts/polymer/src/standard/utils.html +0 -158
  69. data/app/assets/javascripts/polymer/src/standard/x-styling.html +0 -300
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deef29327e7cacd3555ebf35a6a764b468fd9dd3
4
- data.tar.gz: 2632584344b12ababcd62cf92357325f11b7cc13
3
+ metadata.gz: 15d73573adbe903c0f104c33d5a062a871ff4ca1
4
+ data.tar.gz: 2a314296811dac2fbee68f5e6c1986ecb6fab1ae
5
5
  SHA512:
6
- metadata.gz: 733ba2dbc846cafb3ad9790f121ec8a276e5235f94c3b70d168009818cbc98c9ccef37ac1fabd369e33b9022b4e987ad48bed672ce1b4a0e5bf0bb1844c4eac9
7
- data.tar.gz: fc83137fc6b4bf93a4e4f48262c246e576197aa55f5514d9344ca205045c0daeceff7884c4df6fdd7eef92b477734148caef4a1e4d88dac9906e17880d2ed0f1
6
+ metadata.gz: ab98d36b60c02fe9b79d31dcd315c99c818398ac4dfec9bd9ed5d757b3695b5a2aa1428515b309df3ca86440d5b9141bed64899066c513903cb3c105feb3d1c0
7
+ data.tar.gz: 4d2e5a6cbdb2260476c04f1a7fb6ccfea5429d2d1ac7644357d240a3362a4358c8fe974b2e3f67badfd36590d117273e1968e8794aef422b61f4d5e32dc4729c
@@ -6,31 +6,538 @@ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
6
  The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
7
  Code distributed by Google as part of the polymer project is also
8
8
  subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
- <link rel="import" href="src/polymer-lib.html">
11
- <link rel="import" href="src/micro/tag.html">
12
- <link rel="import" href="src/micro/mixins.html">
13
- <link rel="import" href="src/micro/extends.html">
14
- <link rel="import" href="src/micro/constructor.html">
15
- <link rel="import" href="src/micro/properties.html">
16
- <link rel="import" href="src/micro/attributes.html">
9
+ --><script>(function() {
10
+ function resolve() {
11
+ document.body.removeAttribute("unresolved");
12
+ }
13
+ if (window.WebComponents) {
14
+ addEventListener("WebComponentsReady", resolve);
15
+ } else {
16
+ resolve();
17
+ }
18
+ })();
17
19
 
18
- <script>
20
+ Polymer = {
21
+ Settings: function() {
22
+ var user = window.Polymer || {};
23
+ location.search.slice(1).split("&").forEach(function(o) {
24
+ o = o.split("=");
25
+ o[0] && (user[o[0]] = o[1] || true);
26
+ });
27
+ var wantShadow = user.dom === "shadow";
28
+ var hasShadow = Boolean(Element.prototype.createShadowRoot);
29
+ var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
30
+ var useShadow = wantShadow && hasShadow;
31
+ var hasNativeImports = Boolean("import" in document.createElement("link"));
32
+ var useNativeImports = hasNativeImports;
33
+ var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
34
+ return {
35
+ wantShadow: wantShadow,
36
+ hasShadow: hasShadow,
37
+ nativeShadow: nativeShadow,
38
+ useShadow: useShadow,
39
+ useNativeShadow: useShadow && nativeShadow,
40
+ useNativeImports: useNativeImports,
41
+ useNativeCustomElements: useNativeCustomElements
42
+ };
43
+ }()
44
+ };
19
45
 
20
- Polymer.Base.addFeature({
46
+ (function() {
47
+ var userPolymer = window.Polymer;
48
+ window.Polymer = function(prototype) {
49
+ var ctor = desugar(prototype);
50
+ prototype = ctor.prototype;
51
+ var options = {
52
+ prototype: prototype
53
+ };
54
+ if (prototype.extends) {
55
+ options.extends = prototype.extends;
56
+ }
57
+ Polymer.telemetry._registrate(prototype);
58
+ document.registerElement(prototype.is, options);
59
+ return ctor;
60
+ };
61
+ var desugar = function(prototype) {
62
+ prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
63
+ prototype.registerCallback();
64
+ return prototype.constructor;
65
+ };
66
+ window.Polymer = Polymer;
67
+ if (userPolymer) {
68
+ for (var i in userPolymer) {
69
+ Polymer[i] = userPolymer[i];
70
+ }
71
+ }
72
+ Polymer.Class = desugar;
73
+ })();
21
74
 
22
- registerFeatures: function() {
23
- this._prepIs();
24
- this._prepMixins();
25
- this._prepExtends();
26
- this._prepConstructor();
27
- },
75
+ Polymer.telemetry = {
76
+ registrations: [],
77
+ _regLog: function(prototype) {
78
+ console.log("[" + prototype.is + "]: registered");
79
+ },
80
+ _registrate: function(prototype) {
81
+ this.registrations.push(prototype);
82
+ Polymer.log && this._regLog(prototype);
83
+ },
84
+ dumpRegistrations: function() {
85
+ this.registrations.forEach(this._regLog);
86
+ }
87
+ };
28
88
 
29
- initFeatures: function() {
30
- this._marshalAttributes();
31
- }
89
+ Object.defineProperty(window, "currentImport", {
90
+ enumerable: true,
91
+ configurable: true,
92
+ get: function() {
93
+ return (document._currentScript || document.currentScript).ownerDocument;
94
+ }
95
+ });
32
96
 
33
- });
97
+ Polymer.Base = {
98
+ _addFeature: function(feature) {
99
+ this.extend(this, feature);
100
+ },
101
+ registerCallback: function() {
102
+ this._registerFeatures();
103
+ this._doBehavior("registered");
104
+ },
105
+ createdCallback: function() {
106
+ Polymer.telemetry.instanceCount++;
107
+ this.root = this;
108
+ this._doBehavior("created");
109
+ this._initFeatures();
110
+ },
111
+ attachedCallback: function() {
112
+ this.isAttached = true;
113
+ this._doBehavior("attached");
114
+ },
115
+ detachedCallback: function() {
116
+ this.isAttached = false;
117
+ this._doBehavior("detached");
118
+ },
119
+ attributeChangedCallback: function(name) {
120
+ this._setAttributeToProperty(this, name);
121
+ this._doBehavior("attributeChanged", arguments);
122
+ },
123
+ extend: function(prototype, api) {
124
+ if (prototype && api) {
125
+ Object.getOwnPropertyNames(api).forEach(function(n) {
126
+ this.copyOwnProperty(n, api, prototype);
127
+ }, this);
128
+ }
129
+ return prototype || api;
130
+ },
131
+ copyOwnProperty: function(name, source, target) {
132
+ var pd = Object.getOwnPropertyDescriptor(source, name);
133
+ if (pd) {
134
+ Object.defineProperty(target, name, pd);
135
+ }
136
+ },
137
+ _log: console.log.apply.bind(console.log, console),
138
+ _warn: console.warn.apply.bind(console.warn, console),
139
+ _error: console.error.apply.bind(console.error, console),
140
+ _logf: function() {
141
+ return this._logPrefix.concat([ this.is ]).concat(Array.prototype.slice.call(arguments, 0));
142
+ }
143
+ };
34
144
 
35
- </script>
145
+ Polymer.Base._logPrefix = function() {
146
+ var color = window.chrome || /firefox/i.test(navigator.userAgent);
147
+ return color ? [ "%c[%s::%s]:", "font-weight: bold; background-color:#EEEE00;" ] : [ "[%s::%s]:" ];
148
+ }();
36
149
 
150
+ Polymer.Base.chainObject = function(object, inherited) {
151
+ if (object && inherited && object !== inherited) {
152
+ if (!Object.__proto__) {
153
+ object = Polymer.Base.extend(Object.create(inherited), object);
154
+ }
155
+ object.__proto__ = inherited;
156
+ }
157
+ return object;
158
+ };
159
+
160
+ Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
161
+
162
+ Polymer.telemetry.instanceCount = 0;
163
+
164
+ (function() {
165
+ var modules = {};
166
+ var DomModule = function() {
167
+ return document.createElement("dom-module");
168
+ };
169
+ DomModule.prototype = Object.create(HTMLElement.prototype);
170
+ DomModule.prototype.constructor = DomModule;
171
+ DomModule.prototype.createdCallback = function() {
172
+ var id = this.id || this.getAttribute("name") || this.getAttribute("is");
173
+ if (id) {
174
+ this.id = id;
175
+ modules[id] = this;
176
+ }
177
+ };
178
+ DomModule.prototype.import = function(id, slctr) {
179
+ var m = modules[id];
180
+ if (!m) {
181
+ forceDocumentUpgrade();
182
+ m = modules[id];
183
+ }
184
+ if (m && slctr) {
185
+ m = m.querySelector(slctr);
186
+ }
187
+ return m;
188
+ };
189
+ var cePolyfill = window.CustomElements && !CustomElements.useNative;
190
+ if (cePolyfill) {
191
+ var ready = CustomElements.ready;
192
+ CustomElements.ready = true;
193
+ }
194
+ document.registerElement("dom-module", DomModule);
195
+ if (cePolyfill) {
196
+ CustomElements.ready = ready;
197
+ }
198
+ function forceDocumentUpgrade() {
199
+ if (cePolyfill) {
200
+ var script = document._currentScript || document.currentScript;
201
+ if (script) {
202
+ CustomElements.upgradeAll(script.ownerDocument);
203
+ }
204
+ }
205
+ }
206
+ })();
207
+
208
+ Polymer.Base._addFeature({
209
+ _prepIs: function() {
210
+ if (!this.is) {
211
+ var module = (document._currentScript || document.currentScript).parentNode;
212
+ if (module.localName === "dom-module") {
213
+ var id = module.id || module.getAttribute("name") || module.getAttribute("is");
214
+ this.is = id;
215
+ }
216
+ }
217
+ }
218
+ });
219
+
220
+ Polymer.Base._addFeature({
221
+ behaviors: [],
222
+ _prepBehaviors: function() {
223
+ if (this.behaviors.length) {
224
+ this.behaviors = this._flattenBehaviorsList(this.behaviors);
225
+ }
226
+ this._prepAllBehaviors(this.behaviors);
227
+ },
228
+ _flattenBehaviorsList: function(behaviors) {
229
+ var flat = [];
230
+ behaviors.forEach(function(b) {
231
+ if (b instanceof Array) {
232
+ flat = flat.concat(this._flattenBehaviorsList(b));
233
+ } else if (b) {
234
+ flat.push(b);
235
+ } else {
236
+ this._warn(this._logf("_flattenBehaviorsList", "behavior is null, check for missing or 404 import"));
237
+ }
238
+ }, this);
239
+ return flat;
240
+ },
241
+ _prepAllBehaviors: function(behaviors) {
242
+ for (var i = behaviors.length - 1; i >= 0; i--) {
243
+ this._mixinBehavior(behaviors[i]);
244
+ }
245
+ for (var i = 0, l = behaviors.length; i < l; i++) {
246
+ this._prepBehavior(behaviors[i]);
247
+ }
248
+ this._prepBehavior(this);
249
+ },
250
+ _mixinBehavior: function(b) {
251
+ Object.getOwnPropertyNames(b).forEach(function(n) {
252
+ switch (n) {
253
+ case "hostAttributes":
254
+ case "registered":
255
+ case "properties":
256
+ case "observers":
257
+ case "listeners":
258
+ case "created":
259
+ case "attached":
260
+ case "detached":
261
+ case "attributeChanged":
262
+ case "configure":
263
+ case "ready":
264
+ break;
265
+
266
+ default:
267
+ if (!this.hasOwnProperty(n)) {
268
+ this.copyOwnProperty(n, b, this);
269
+ }
270
+ break;
271
+ }
272
+ }, this);
273
+ },
274
+ _doBehavior: function(name, args) {
275
+ this.behaviors.forEach(function(b) {
276
+ this._invokeBehavior(b, name, args);
277
+ }, this);
278
+ this._invokeBehavior(this, name, args);
279
+ },
280
+ _invokeBehavior: function(b, name, args) {
281
+ var fn = b[name];
282
+ if (fn) {
283
+ fn.apply(this, args || Polymer.nar);
284
+ }
285
+ },
286
+ _marshalBehaviors: function() {
287
+ this.behaviors.forEach(function(b) {
288
+ this._marshalBehavior(b);
289
+ }, this);
290
+ this._marshalBehavior(this);
291
+ }
292
+ });
293
+
294
+ Polymer.Base._addFeature({
295
+ _prepExtends: function() {
296
+ if (this.extends) {
297
+ this.__proto__ = this._getExtendedPrototype(this.extends);
298
+ }
299
+ },
300
+ _getExtendedPrototype: function(tag) {
301
+ return this._getExtendedNativePrototype(tag);
302
+ },
303
+ _nativePrototypes: {},
304
+ _getExtendedNativePrototype: function(tag) {
305
+ var p = this._nativePrototypes[tag];
306
+ if (!p) {
307
+ var np = this.getNativePrototype(tag);
308
+ p = this.extend(Object.create(np), Polymer.Base);
309
+ this._nativePrototypes[tag] = p;
310
+ }
311
+ return p;
312
+ },
313
+ getNativePrototype: function(tag) {
314
+ return Object.getPrototypeOf(document.createElement(tag));
315
+ }
316
+ });
317
+
318
+ Polymer.Base._addFeature({
319
+ _prepConstructor: function() {
320
+ this._factoryArgs = this.extends ? [ this.extends, this.is ] : [ this.is ];
321
+ var ctor = function() {
322
+ return this._factory(arguments);
323
+ };
324
+ if (this.hasOwnProperty("extends")) {
325
+ ctor.extends = this.extends;
326
+ }
327
+ Object.defineProperty(this, "constructor", {
328
+ value: ctor,
329
+ writable: true,
330
+ configurable: true
331
+ });
332
+ ctor.prototype = this;
333
+ },
334
+ _factory: function(args) {
335
+ var elt = document.createElement.apply(document, this._factoryArgs);
336
+ if (this.factoryImpl) {
337
+ this.factoryImpl.apply(elt, args);
338
+ }
339
+ return elt;
340
+ }
341
+ });
342
+
343
+ Polymer.nob = Object.create(null);
344
+
345
+ Polymer.Base._addFeature({
346
+ properties: {},
347
+ getPropertyInfo: function(property) {
348
+ var info = this._getPropertyInfo(property, this.properties);
349
+ if (!info) {
350
+ this.behaviors.some(function(b) {
351
+ return info = this._getPropertyInfo(property, b.properties);
352
+ }, this);
353
+ }
354
+ return info || Polymer.nob;
355
+ },
356
+ _getPropertyInfo: function(property, properties) {
357
+ var p = properties && properties[property];
358
+ if (typeof p === "function") {
359
+ p = properties[property] = {
360
+ type: p
361
+ };
362
+ }
363
+ if (p) {
364
+ p.defined = true;
365
+ }
366
+ return p;
367
+ }
368
+ });
369
+
370
+ Polymer.CaseMap = {
371
+ _caseMap: {},
372
+ dashToCamelCase: function(dash) {
373
+ var mapped = Polymer.CaseMap._caseMap[dash];
374
+ if (mapped) {
375
+ return mapped;
376
+ }
377
+ if (dash.indexOf("-") < 0) {
378
+ return Polymer.CaseMap._caseMap[dash] = dash;
379
+ }
380
+ return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function(m) {
381
+ return m[1].toUpperCase();
382
+ });
383
+ },
384
+ camelToDashCase: function(camel) {
385
+ var mapped = Polymer.CaseMap._caseMap[camel];
386
+ if (mapped) {
387
+ return mapped;
388
+ }
389
+ return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function(g) {
390
+ return g[0] + "-" + g[1].toLowerCase();
391
+ });
392
+ }
393
+ };
394
+
395
+ Polymer.Base._addFeature({
396
+ _prepAttributes: function() {
397
+ this._aggregatedAttributes = {};
398
+ },
399
+ _addHostAttributes: function(attributes) {
400
+ if (attributes) {
401
+ this.mixin(this._aggregatedAttributes, attributes);
402
+ }
403
+ },
404
+ _marshalHostAttributes: function() {
405
+ this._applyAttributes(this, this._aggregatedAttributes);
406
+ },
407
+ _applyAttributes: function(node, attr$) {
408
+ for (var n in attr$) {
409
+ if (!this.hasAttribute(n) && n !== "class") {
410
+ this.serializeValueToAttribute(attr$[n], n, this);
411
+ }
412
+ }
413
+ },
414
+ _marshalAttributes: function() {
415
+ this._takeAttributesToModel(this);
416
+ },
417
+ _takeAttributesToModel: function(model) {
418
+ for (var i = 0, l = this.attributes.length; i < l; i++) {
419
+ this._setAttributeToProperty(model, this.attributes[i].name);
420
+ }
421
+ },
422
+ _setAttributeToProperty: function(model, attrName) {
423
+ if (!this._serializing) {
424
+ var propName = Polymer.CaseMap.dashToCamelCase(attrName);
425
+ var info = this.getPropertyInfo(propName);
426
+ if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
427
+ var val = this.getAttribute(attrName);
428
+ model[propName] = this.deserialize(val, info.type);
429
+ }
430
+ }
431
+ },
432
+ _serializing: false,
433
+ reflectPropertyToAttribute: function(name) {
434
+ this._serializing = true;
435
+ this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
436
+ this._serializing = false;
437
+ },
438
+ serializeValueToAttribute: function(value, attribute, node) {
439
+ var str = this.serialize(value);
440
+ (node || this)[str === undefined ? "removeAttribute" : "setAttribute"](attribute, str);
441
+ },
442
+ deserialize: function(value, type) {
443
+ switch (type) {
444
+ case Number:
445
+ value = Number(value);
446
+ break;
447
+
448
+ case Boolean:
449
+ value = value !== null;
450
+ break;
451
+
452
+ case Object:
453
+ try {
454
+ value = JSON.parse(value);
455
+ } catch (x) {}
456
+ break;
457
+
458
+ case Array:
459
+ try {
460
+ value = JSON.parse(value);
461
+ } catch (x) {
462
+ value = null;
463
+ console.warn("Polymer::Attributes: couldn`t decode Array as JSON");
464
+ }
465
+ break;
466
+
467
+ case Date:
468
+ value = new Date(value);
469
+ break;
470
+
471
+ case String:
472
+ default:
473
+ break;
474
+ }
475
+ return value;
476
+ },
477
+ serialize: function(value) {
478
+ switch (typeof value) {
479
+ case "boolean":
480
+ return value ? "" : undefined;
481
+
482
+ case "object":
483
+ if (value instanceof Date) {
484
+ return value;
485
+ } else if (value) {
486
+ try {
487
+ return JSON.stringify(value);
488
+ } catch (x) {
489
+ return "";
490
+ }
491
+ }
492
+
493
+ default:
494
+ return value != null ? value : undefined;
495
+ }
496
+ }
497
+ });
498
+
499
+ Polymer.Base._addFeature({
500
+ _setupDebouncers: function() {
501
+ this._debouncers = {};
502
+ },
503
+ debounce: function(jobName, callback, wait) {
504
+ this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
505
+ },
506
+ isDebouncerActive: function(jobName) {
507
+ var debouncer = this._debouncers[jobName];
508
+ return debouncer && debouncer.finish;
509
+ },
510
+ flushDebouncer: function(jobName) {
511
+ var debouncer = this._debouncers[jobName];
512
+ if (debouncer) {
513
+ debouncer.complete();
514
+ }
515
+ },
516
+ cancelDebouncer: function(jobName) {
517
+ var debouncer = this._debouncers[jobName];
518
+ if (debouncer) {
519
+ debouncer.stop();
520
+ }
521
+ }
522
+ });
523
+
524
+ Polymer.version = "1.0.2";
525
+
526
+ Polymer.Base._addFeature({
527
+ _registerFeatures: function() {
528
+ this._prepIs();
529
+ this._prepAttributes();
530
+ this._prepBehaviors();
531
+ this._prepExtends();
532
+ this._prepConstructor();
533
+ },
534
+ _prepBehavior: function(b) {
535
+ this._addHostAttributes(b.hostAttributes);
536
+ },
537
+ _marshalBehavior: function(b) {},
538
+ _initFeatures: function() {
539
+ this._marshalHostAttributes();
540
+ this._setupDebouncers();
541
+ this._marshalBehaviors();
542
+ }
543
+ });</script>