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