polymer-rails 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6af060c005a4b9f3d7a7631ed258a09f8b72796
|
4
|
+
data.tar.gz: 73bd6ea2e11eb0c34f118cbc4317b5cd8b4630db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 860b465925381619cdc150096e249420e7e65010ed554e0793f32d650c88596376c36176f2b73586533da2438c58c4d9becaa43e1f3ec27cdac618fca2658e7d
|
7
|
+
data.tar.gz: 7d324d014cc63df2308f928a0fdff92ed90fc85f0ea4a1f36019c1ff72f7d2d44cc689c024ea3a3f3680baf6d162c6ff009f8d100319d3decac16cd4d78d368a
|
@@ -20,7 +20,7 @@ addEventListener('DOMContentLoaded', resolve);
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
}());
|
23
|
-
Polymer = {
|
23
|
+
window.Polymer = {
|
24
24
|
Settings: function () {
|
25
25
|
var user = window.Polymer || {};
|
26
26
|
location.search.slice(1).split('&').forEach(function (o) {
|
@@ -48,15 +48,21 @@ useNativeCustomElements: useNativeCustomElements
|
|
48
48
|
(function () {
|
49
49
|
var userPolymer = window.Polymer;
|
50
50
|
window.Polymer = function (prototype) {
|
51
|
-
|
52
|
-
prototype =
|
53
|
-
|
54
|
-
if (prototype
|
55
|
-
|
51
|
+
if (typeof prototype === 'function') {
|
52
|
+
prototype = prototype.prototype;
|
53
|
+
}
|
54
|
+
if (!prototype) {
|
55
|
+
prototype = {};
|
56
56
|
}
|
57
|
+
var factory = desugar(prototype);
|
58
|
+
prototype = factory.prototype;
|
59
|
+
var options = {
|
60
|
+
prototype: prototype,
|
61
|
+
extends: prototype.extends
|
62
|
+
};
|
57
63
|
Polymer.telemetry._registrate(prototype);
|
58
64
|
document.registerElement(prototype.is, options);
|
59
|
-
return
|
65
|
+
return factory;
|
60
66
|
};
|
61
67
|
var desugar = function (prototype) {
|
62
68
|
var base = Polymer.Base;
|
@@ -133,6 +139,8 @@ _addFeature: function (feature) {
|
|
133
139
|
this.extend(this, feature);
|
134
140
|
},
|
135
141
|
registerCallback: function () {
|
142
|
+
this._desugarBehaviors();
|
143
|
+
this._doBehavior('beforeRegister');
|
136
144
|
this._registerFeatures();
|
137
145
|
this._doBehavior('registered');
|
138
146
|
},
|
@@ -238,6 +246,7 @@ lcModules[id.toLowerCase()] = this;
|
|
238
246
|
}
|
239
247
|
},
|
240
248
|
import: function (id, selector) {
|
249
|
+
if (id) {
|
241
250
|
var m = findModule(id);
|
242
251
|
if (!m) {
|
243
252
|
forceDocumentUpgrade();
|
@@ -248,6 +257,7 @@ m = m.querySelector(selector);
|
|
248
257
|
}
|
249
258
|
return m;
|
250
259
|
}
|
260
|
+
}
|
251
261
|
});
|
252
262
|
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
253
263
|
document.registerElement('dom-module', DomModule);
|
@@ -255,8 +265,7 @@ function forceDocumentUpgrade() {
|
|
255
265
|
if (cePolyfill) {
|
256
266
|
var script = document._currentScript || document.currentScript;
|
257
267
|
var doc = script && script.ownerDocument;
|
258
|
-
if (doc
|
259
|
-
doc.__customElementsForceUpgraded = true;
|
268
|
+
if (doc) {
|
260
269
|
CustomElements.upgradeAll(doc);
|
261
270
|
}
|
262
271
|
}
|
@@ -278,11 +287,17 @@ this.is = this.is.toLowerCase();
|
|
278
287
|
});
|
279
288
|
Polymer.Base._addFeature({
|
280
289
|
behaviors: [],
|
281
|
-
|
290
|
+
_desugarBehaviors: function () {
|
282
291
|
if (this.behaviors.length) {
|
283
|
-
this.behaviors = this.
|
292
|
+
this.behaviors = this._desugarSomeBehaviors(this.behaviors);
|
284
293
|
}
|
285
|
-
|
294
|
+
},
|
295
|
+
_desugarSomeBehaviors: function (behaviors) {
|
296
|
+
behaviors = this._flattenBehaviorsList(behaviors);
|
297
|
+
for (var i = behaviors.length - 1; i >= 0; i--) {
|
298
|
+
this._mixinBehavior(behaviors[i]);
|
299
|
+
}
|
300
|
+
return behaviors;
|
286
301
|
},
|
287
302
|
_flattenBehaviorsList: function (behaviors) {
|
288
303
|
var flat = [];
|
@@ -297,15 +312,6 @@ this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for miss
|
|
297
312
|
}, this);
|
298
313
|
return flat;
|
299
314
|
},
|
300
|
-
_prepAllBehaviors: function (behaviors) {
|
301
|
-
for (var i = behaviors.length - 1; i >= 0; i--) {
|
302
|
-
this._mixinBehavior(behaviors[i]);
|
303
|
-
}
|
304
|
-
for (var i = 0, l = behaviors.length; i < l; i++) {
|
305
|
-
this._prepBehavior(behaviors[i]);
|
306
|
-
}
|
307
|
-
this._prepBehavior(this);
|
308
|
-
},
|
309
315
|
_mixinBehavior: function (b) {
|
310
316
|
Object.getOwnPropertyNames(b).forEach(function (n) {
|
311
317
|
switch (n) {
|
@@ -329,6 +335,15 @@ break;
|
|
329
335
|
}
|
330
336
|
}, this);
|
331
337
|
},
|
338
|
+
_prepBehaviors: function () {
|
339
|
+
this._prepFlattenedBehaviors(this.behaviors);
|
340
|
+
},
|
341
|
+
_prepFlattenedBehaviors: function (behaviors) {
|
342
|
+
for (var i = 0, l = behaviors.length; i < l; i++) {
|
343
|
+
this._prepBehavior(behaviors[i]);
|
344
|
+
}
|
345
|
+
this._prepBehavior(this);
|
346
|
+
},
|
332
347
|
_doBehavior: function (name, args) {
|
333
348
|
this.behaviors.forEach(function (b) {
|
334
349
|
this._invokeBehavior(b, name, args);
|
@@ -561,7 +576,7 @@ debouncer.stop();
|
|
561
576
|
}
|
562
577
|
}
|
563
578
|
});
|
564
|
-
Polymer.version = '1.1.
|
579
|
+
Polymer.version = '1.1.2';
|
565
580
|
Polymer.Base._addFeature({
|
566
581
|
_registerFeatures: function () {
|
567
582
|
this._prepIs();
|
@@ -580,8 +580,9 @@ return added;
|
|
580
580
|
},
|
581
581
|
_tryRemoveUndistributedNode: function (node) {
|
582
582
|
if (this.node.shadyRoot) {
|
583
|
-
|
584
|
-
|
583
|
+
var parent = getComposedParent(node);
|
584
|
+
if (parent) {
|
585
|
+
nativeRemoveChild.call(parent, node);
|
585
586
|
}
|
586
587
|
return true;
|
587
588
|
}
|
@@ -618,7 +619,7 @@ if (root && hostNeedsDist) {
|
|
618
619
|
this._updateInsertionPoints(root.host);
|
619
620
|
this._lazyDistribute(root.host);
|
620
621
|
} else if (ensureComposedRemoval) {
|
621
|
-
removeFromComposedParent(node
|
622
|
+
removeFromComposedParent(getComposedParent(node), node);
|
622
623
|
}
|
623
624
|
},
|
624
625
|
_removeDistributedChildren: function (root, container) {
|
@@ -842,7 +843,7 @@ configurable: true
|
|
842
843
|
},
|
843
844
|
parentNode: {
|
844
845
|
get: function () {
|
845
|
-
return this.node._lightParent || (this.node
|
846
|
+
return this.node._lightParent || getComposedParent(this.node);
|
846
847
|
},
|
847
848
|
configurable: true
|
848
849
|
},
|
@@ -964,6 +965,18 @@ DomApi.prototype._getComposedInnerHTML = function () {
|
|
964
965
|
return getInnerHTML(this.node, true);
|
965
966
|
};
|
966
967
|
} else {
|
968
|
+
var forwardMethods = [
|
969
|
+
'cloneNode',
|
970
|
+
'appendChild',
|
971
|
+
'insertBefore',
|
972
|
+
'removeChild',
|
973
|
+
'replaceChild'
|
974
|
+
];
|
975
|
+
forwardMethods.forEach(function (name) {
|
976
|
+
DomApi.prototype[name] = function () {
|
977
|
+
return this.node[name].apply(this.node, arguments);
|
978
|
+
};
|
979
|
+
});
|
967
980
|
DomApi.prototype.querySelectorAll = function (selector) {
|
968
981
|
return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
969
982
|
};
|
@@ -976,9 +989,6 @@ return n;
|
|
976
989
|
n = n.parentNode;
|
977
990
|
}
|
978
991
|
};
|
979
|
-
DomApi.prototype.cloneNode = function (deep) {
|
980
|
-
return this.node.cloneNode(deep);
|
981
|
-
};
|
982
992
|
DomApi.prototype.importNode = function (externalNode, deep) {
|
983
993
|
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
984
994
|
return doc.importNode(externalNode, deep);
|
@@ -1025,7 +1035,7 @@ return this.node.innerHTML = value;
|
|
1025
1035
|
configurable: true
|
1026
1036
|
}
|
1027
1037
|
});
|
1028
|
-
var
|
1038
|
+
var forwardProperties = [
|
1029
1039
|
'parentNode',
|
1030
1040
|
'firstChild',
|
1031
1041
|
'lastChild',
|
@@ -1036,7 +1046,7 @@ var forwards = [
|
|
1036
1046
|
'nextElementSibling',
|
1037
1047
|
'previousElementSibling'
|
1038
1048
|
];
|
1039
|
-
|
1049
|
+
forwardProperties.forEach(function (name) {
|
1040
1050
|
Object.defineProperty(DomApi.prototype, name, {
|
1041
1051
|
get: function () {
|
1042
1052
|
return this.node[name];
|
@@ -1120,6 +1130,9 @@ node._composedChildren = null;
|
|
1120
1130
|
addNodeToComposedChildren(node, parent, children, i);
|
1121
1131
|
}
|
1122
1132
|
}
|
1133
|
+
function getComposedParent(node) {
|
1134
|
+
return node.__patched ? node._composedParent : node.parentNode;
|
1135
|
+
}
|
1123
1136
|
function addNodeToComposedChildren(node, parent, children, i) {
|
1124
1137
|
node._composedParent = parent;
|
1125
1138
|
children.splice(i >= 0 ? i : children.length, 0, node);
|
@@ -1150,6 +1163,7 @@ var p = Element.prototype;
|
|
1150
1163
|
var matchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
|
1151
1164
|
return {
|
1152
1165
|
getLightChildren: getLightChildren,
|
1166
|
+
getComposedParent: getComposedParent,
|
1153
1167
|
getComposedChildren: getComposedChildren,
|
1154
1168
|
removeFromComposedParent: removeFromComposedParent,
|
1155
1169
|
saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
|
@@ -1338,7 +1352,9 @@ var composed = getComposedChildren(container);
|
|
1338
1352
|
var splices = Polymer.ArraySplice.calculateSplices(children, composed);
|
1339
1353
|
for (var i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) {
|
1340
1354
|
for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
|
1355
|
+
if (getComposedParent(n) === container) {
|
1341
1356
|
remove(n);
|
1357
|
+
}
|
1342
1358
|
composed.splice(s.index + d, 1);
|
1343
1359
|
}
|
1344
1360
|
d -= s.addedCount;
|
@@ -1351,6 +1367,7 @@ insertBefore(container, n, next);
|
|
1351
1367
|
composed.splice(j, 0, n);
|
1352
1368
|
}
|
1353
1369
|
}
|
1370
|
+
ensureComposedParent(container, children);
|
1354
1371
|
},
|
1355
1372
|
_matchesContentSelect: function (node, contentElement) {
|
1356
1373
|
var select = contentElement.getAttribute('select');
|
@@ -1380,6 +1397,7 @@ var getLightChildren = Polymer.DomApi.getLightChildren;
|
|
1380
1397
|
var matchesSelector = Polymer.DomApi.matchesSelector;
|
1381
1398
|
var hasInsertionPoint = Polymer.DomApi.hasInsertionPoint;
|
1382
1399
|
var getComposedChildren = Polymer.DomApi.getComposedChildren;
|
1400
|
+
var getComposedParent = Polymer.DomApi.getComposedParent;
|
1383
1401
|
var removeFromComposedParent = Polymer.DomApi.removeFromComposedParent;
|
1384
1402
|
function distributeNodeInto(child, insertionPoint) {
|
1385
1403
|
insertionPoint._distributedNodes.push(child);
|
@@ -1433,8 +1451,10 @@ node._composedParent = null;
|
|
1433
1451
|
nativeRemoveChild.call(parentNode, node);
|
1434
1452
|
}
|
1435
1453
|
}
|
1436
|
-
function
|
1437
|
-
|
1454
|
+
function ensureComposedParent(parent, children) {
|
1455
|
+
for (var i = 0, n; i < children.length; i++) {
|
1456
|
+
children[i]._composedParent = parent;
|
1457
|
+
}
|
1438
1458
|
}
|
1439
1459
|
function getTopDistributingHost(host) {
|
1440
1460
|
while (host && hostNeedsRedistribution(host)) {
|
@@ -236,7 +236,11 @@ if (!this._template) {
|
|
236
236
|
this._notes = [];
|
237
237
|
} else {
|
238
238
|
Polymer.Annotations.prepElement = this._prepElement.bind(this);
|
239
|
+
if (this._template._content && this._template._content._notes) {
|
240
|
+
this._notes = this._template._content._notes;
|
241
|
+
} else {
|
239
242
|
this._notes = Polymer.Annotations.parseAnnotations(this._template);
|
243
|
+
}
|
240
244
|
this._processAnnotations(this._notes);
|
241
245
|
Polymer.Annotations.prepElement = null;
|
242
246
|
}
|
@@ -2233,6 +2237,9 @@ clearStyleRules: function (style) {
|
|
2233
2237
|
style.__cssRules = null;
|
2234
2238
|
},
|
2235
2239
|
forEachStyleRule: function (node, callback) {
|
2240
|
+
if (!node) {
|
2241
|
+
return;
|
2242
|
+
}
|
2236
2243
|
var s = node.parsedSelector;
|
2237
2244
|
var skipRules = false;
|
2238
2245
|
if (node.type === this.ruleTypes.STYLE_RULE) {
|
@@ -2261,19 +2268,22 @@ afterNode = n$[n$.length - 1];
|
|
2261
2268
|
target.insertBefore(style, afterNode && afterNode.nextSibling || target.firstChild);
|
2262
2269
|
return style;
|
2263
2270
|
},
|
2264
|
-
cssFromModules: function (moduleIds) {
|
2271
|
+
cssFromModules: function (moduleIds, warnIfNotFound) {
|
2265
2272
|
var modules = moduleIds.trim().split(' ');
|
2266
2273
|
var cssText = '';
|
2267
2274
|
for (var i = 0; i < modules.length; i++) {
|
2268
|
-
cssText += this.cssFromModule(modules[i]);
|
2275
|
+
cssText += this.cssFromModule(modules[i], warnIfNotFound);
|
2269
2276
|
}
|
2270
2277
|
return cssText;
|
2271
2278
|
},
|
2272
|
-
cssFromModule: function (moduleId) {
|
2279
|
+
cssFromModule: function (moduleId, warnIfNotFound) {
|
2273
2280
|
var m = Polymer.DomModule.import(moduleId);
|
2274
2281
|
if (m && !m._cssText) {
|
2275
2282
|
m._cssText = this._cssFromElement(m);
|
2276
2283
|
}
|
2284
|
+
if (!m && warnIfNotFound) {
|
2285
|
+
console.warn('Could not find style data in module named', moduleId);
|
2286
|
+
}
|
2277
2287
|
return m && m._cssText || '';
|
2278
2288
|
},
|
2279
2289
|
_cssFromElement: function (element) {
|
@@ -2287,12 +2297,12 @@ cssText += this._cssFromElement(e);
|
|
2287
2297
|
} else {
|
2288
2298
|
if (e.localName === 'style') {
|
2289
2299
|
var include = e.getAttribute(this.INCLUDE_ATTR);
|
2300
|
+
if (include) {
|
2301
|
+
cssText += this.cssFromModules(include, true);
|
2302
|
+
}
|
2290
2303
|
e = e.__appliedElement || e;
|
2291
2304
|
e.parentNode.removeChild(e);
|
2292
2305
|
cssText += this.resolveCss(e.textContent, element.ownerDocument);
|
2293
|
-
if (include) {
|
2294
|
-
cssText += this.cssFromModules(include);
|
2295
|
-
}
|
2296
2306
|
} else if (e.import && e.import.body) {
|
2297
2307
|
cssText += this.resolveCss(e.import.body.textContent, e.import);
|
2298
2308
|
}
|
@@ -3229,15 +3239,20 @@ observer.observe(e, { childList: true });
|
|
3229
3239
|
_apply: function () {
|
3230
3240
|
var e = this.__appliedElement || this;
|
3231
3241
|
if (this.include) {
|
3232
|
-
e.textContent
|
3242
|
+
e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent;
|
3233
3243
|
}
|
3234
|
-
|
3235
|
-
styleUtil.forEachStyleRule(
|
3244
|
+
if (e.textContent) {
|
3245
|
+
styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
|
3236
3246
|
styleTransformer.documentRule(rule);
|
3237
3247
|
});
|
3248
|
+
this._applyCustomProperties(e);
|
3249
|
+
}
|
3250
|
+
},
|
3251
|
+
_applyCustomProperties: function (element) {
|
3238
3252
|
this._computeStyleProperties();
|
3239
3253
|
var props = this._styleProperties;
|
3240
|
-
|
3254
|
+
var rules = styleUtil.rulesForStyle(element);
|
3255
|
+
element.textContent = styleUtil.toCssText(rules, function (rule) {
|
3241
3256
|
var css = rule.cssText = rule.parsedCssText;
|
3242
3257
|
if (rule.propertyInfo && rule.propertyInfo.cssText) {
|
3243
3258
|
css = cssParse.removeCustomPropAssignment(css);
|