From ec855827feb4fea3e0f60456658e76ff2e8df67f Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Thu, 18 Feb 2016 18:32:36 -0800 Subject: [PATCH] Serialize before deserialize when configuring attrs. Fixes #3433. --- src/micro/attributes.html | 2 +- src/standard/configure.html | 4 ++-- test/unit/configure-elements.html | 13 +++++++++++-- test/unit/configure.html | 8 +++++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/micro/attributes.html b/src/micro/attributes.html index d2799f9a51..29df6704ad 100644 --- a/src/micro/attributes.html +++ b/src/micro/attributes.html @@ -193,7 +193,7 @@ break; case Boolean: - value = (value !== null); + value = (value != null); break; case Object: diff --git a/src/standard/configure.html b/src/standard/configure.html index 378d25729d..cb244a7c34 100644 --- a/src/standard/configure.html +++ b/src/standard/configure.html @@ -116,7 +116,7 @@ _configureProperties: function(properties, config) { for (var i in properties) { var c = properties[i]; - // Allow properties set before upgrade on the instance + // Allow properties set before upgrade on the instance // to override default values. This allows late upgrade + an early set // to not b0rk accessors on the prototype. // Perf testing has shown `hasOwnProperty` to be ok here. @@ -153,7 +153,7 @@ var value = (p === x.effect.value) ? config[p] : this._get(x.effect.value, config); if (x.effect.kind == 'attribute') { - value = node.deserialize(value, + value = node.deserialize(node.serialize(value), node._propertyInfo[name].type); } node._configValue(name, value); diff --git a/test/unit/configure-elements.html b/test/unit/configure-elements.html index f31abdaca2..2b75969bb7 100644 --- a/test/unit/configure-elements.html +++ b/test/unit/configure-elements.html @@ -128,12 +128,18 @@ type: Number, observer: 'attrNumberChanged', value: 0 + }, + attrBoolean: { + type: Boolean, + observer: 'attrBooleanChanged', + // value: true } }, created: function() { this.attrDashChanged = sinon.spy(); this.attrNumberChanged = sinon.spy(); + this.attrBooleanChanged = sinon.spy(); } }); @@ -142,7 +148,7 @@