don't forget to takeAttributes

This commit is contained in:
Scott J Miles
2015-04-16 00:12:56 -07:00
parent 940d975955
commit 7e9a50296f
2 changed files with 23 additions and 23 deletions

View File

@@ -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 (?)

View File

@@ -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;
}
}