mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
don't forget to takeAttributes
This commit is contained in:
@@ -67,10 +67,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
this._marshalAnnotationReferences();
|
||||
// concretize effects on instance
|
||||
this._marshalInstanceEffects();
|
||||
// acquire behaviors
|
||||
// acquire instance behaviors
|
||||
this._marshalBehaviors();
|
||||
// publish attributes to instance
|
||||
//this._marshalAttributes();
|
||||
// acquire initial instance attribute values
|
||||
this._marshalAttributes();
|
||||
// establish listeners on instance
|
||||
//this._marshalListeners();
|
||||
// initial distribution (?)
|
||||
|
||||
@@ -13,7 +13,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
<link rel="import" href="../lib/style-defaults.html">
|
||||
<script>
|
||||
(function() {
|
||||
|
||||
|
||||
var baseAttachedCallback = Polymer.Base.attachedCallback;
|
||||
var baseSerializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
|
||||
|
||||
@@ -25,7 +25,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
attachedCallback: function() {
|
||||
baseAttachedCallback.call(this);
|
||||
if (this.enableCustomStyleProperties && !this._xScopeSelector) {
|
||||
if (!this._xScopeSelector) {
|
||||
this._updateOwnStyles();
|
||||
}
|
||||
},
|
||||
@@ -39,7 +39,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
_computeStyleProperties: function() {
|
||||
var props = {};
|
||||
this.simpleMixin(props, this._computeStylePropertiesFromHost());
|
||||
this.simpleMixin(props, this._computeStylePropertiesFromHost());
|
||||
this.simpleMixin(props, this._computeOwnStyleProperties());
|
||||
this._reifyCustomProperties(props);
|
||||
return props;
|
||||
@@ -59,7 +59,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
this.simpleMixin(props,
|
||||
this._customPropertiesFromStyles(styles, this.host));
|
||||
return props;
|
||||
|
||||
|
||||
},
|
||||
|
||||
_computeOwnStyleProperties: function() {
|
||||
@@ -84,7 +84,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
return props;
|
||||
},
|
||||
|
||||
// test if a rule matches the given node and if so,
|
||||
// test if a rule matches the given node and if so,
|
||||
// collect any custom properties
|
||||
// TODO(sorvell): support custom variable assignment within mixins
|
||||
_customPropertiesFromRule: function(props, hostNode, rule) {
|
||||
@@ -107,7 +107,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
properties[m[1]] = m[2].trim();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_reifyCustomProperties: function(props) {
|
||||
for (var i in props) {
|
||||
props[i] = this._valueForCustomProperty(props[i], props);
|
||||
@@ -116,7 +116,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
_valueForCustomProperty: function(property, props) {
|
||||
var cv;
|
||||
while ((typeof property === 'string') &&
|
||||
while ((typeof property === 'string') &&
|
||||
(cv = property.match(CUSTOM_VAR_VALUE))) {
|
||||
property = props[cv[1]];
|
||||
}
|
||||
@@ -133,7 +133,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
if (!style) {
|
||||
var cssText = this._generateCustomStyleCss(bag, s$);
|
||||
style = cssText ? this._applyCustomCss(cssText) : {};
|
||||
cacheStyle(this.is, style, this._xScopeSelector,
|
||||
cacheStyle(this.is, style, this._xScopeSelector,
|
||||
this._styleProperties, s$);
|
||||
} else if (nativeShadow) {
|
||||
this._applyCustomCss(style.textContent);
|
||||
@@ -161,17 +161,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
_generateCustomStyleCss: function(properties, styles) {
|
||||
var b = this._applyPropertiesToRule.bind(this, properties);
|
||||
var cssText = '';
|
||||
// TODO(sorvell): don't redo parsing work each time as below;
|
||||
// TODO(sorvell): don't redo parsing work each time as below;
|
||||
// instead create a sheet with just custom properties
|
||||
for (var i=0, l=styles.length, s; (i<l) && (s=styles[i]); i++) {
|
||||
cssText += this._transformCss(s.textContent, b) + '\n\n';
|
||||
cssText += this._transformCss(s.textContent, b) + '\n\n';
|
||||
}
|
||||
return cssText.trim();
|
||||
},
|
||||
|
||||
_transformCss: function(cssText, callback) {
|
||||
return nativeShadow ?
|
||||
Polymer.StyleUtil.toCssText(cssText, callback) :
|
||||
Polymer.StyleUtil.toCssText(cssText, callback) :
|
||||
Polymer.StyleTransformer.css(cssText, this.is, this.extends, callback,
|
||||
this._scopeCssViaAttr);
|
||||
},
|
||||
@@ -179,7 +179,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
_xScopeCount: 0,
|
||||
|
||||
_ensureScopeSelector: function(selector) {
|
||||
selector = selector || (this.is + '-' +
|
||||
selector = selector || (this.is + '-' +
|
||||
(Object.getPrototypeOf(this)._xScopeCount++));
|
||||
this._xScopeSelector = selector;
|
||||
},
|
||||
@@ -188,7 +188,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
if (this._customStyle) {
|
||||
this._customStyle.textContent = cssText;
|
||||
} else if (cssText) {
|
||||
this._customStyle = Polymer.StyleUtil.applyCss(cssText,
|
||||
this._customStyle = Polymer.StyleUtil.applyCss(cssText,
|
||||
this._xScopeSelector,
|
||||
nativeShadow ? this.root : null);
|
||||
}
|
||||
@@ -260,8 +260,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
_scopeElementClass: function(element, selector) {
|
||||
if (!nativeShadow && !this._scopeCssViaAttr) {
|
||||
selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is +
|
||||
(element._xScopeSelector ? ' ' + XSCOPE_NAME + ' ' +
|
||||
selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is +
|
||||
(element._xScopeSelector ? ' ' + XSCOPE_NAME + ' ' +
|
||||
element._xScopeSelector : '');
|
||||
}
|
||||
return selector;
|
||||
@@ -297,9 +297,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
},
|
||||
|
||||
_updateRootStyles: function(root) {
|
||||
// TODO(sorvell): temporary way to find local dom that needs
|
||||
// TODO(sorvell): temporary way to find local dom that needs
|
||||
// x-scope styling.
|
||||
var scopeSelector = this._scopeCssViaAttr ?
|
||||
var scopeSelector = this._scopeCssViaAttr ?
|
||||
'[' + SCOPE_NAME + '~=' + XSCOPE_NAME + ']' : '.' + XSCOPE_NAME;
|
||||
var c$ = Polymer.dom(root).querySelectorAll(scopeSelector);
|
||||
for (var i=0, l= c$.length, c; (i<l) && (c=c$[i]); i++) {
|
||||
@@ -310,7 +310,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
var styleCache = {};
|
||||
function cacheStyle(is, style, scope, bag, styles) {
|
||||
style._scope = scope;
|
||||
@@ -325,8 +325,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
if (styles) {
|
||||
for (var i=0, s; i < styles.length; i++) {
|
||||
s = styles[i];
|
||||
if (objectsEqual(bag, s._properties) &&
|
||||
objectsEqual(checkStyles, s._styles)) {
|
||||
if (objectsEqual(bag, s._properties) &&
|
||||
objectsEqual(checkStyles, s._styles)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user