From 1a5c391b7d0d037c48d243763ec0602c5611678b Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Thu, 16 Jul 2015 18:47:39 -0700 Subject: [PATCH] Fixes #2098: don't accept undefined values as initial config --- src/standard/configure.html | 9 +++- test/smoke/bind-smoke2.html | 68 +++++++++++++++++++++++++++++++ test/unit/dom-bind-elements1.html | 12 ++++++ test/unit/dom-bind.html | 7 ++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 test/smoke/bind-smoke2.html diff --git a/src/standard/configure.html b/src/standard/configure.html index 7a6210a96c..39e7158f71 100644 --- a/src/standard/configure.html +++ b/src/standard/configure.html @@ -45,7 +45,13 @@ // storage for configuration _setupConfigure: function(initialConfig) { - this._config = initialConfig || {}; + this._config = {}; + // don't accept undefined values in intialConfig + for (var i in initialConfig) { + if (initialConfig[i] !== undefined) { + this._config[i] = initialConfig[i]; + } + } this._handlers = []; }, @@ -92,6 +98,7 @@ _configureProperties: function(properties, config) { for (var i in properties) { var c = properties[i]; + // don't accept undefined values if (c.value !== undefined) { var value = c.value; if (typeof value == 'function') { diff --git a/test/smoke/bind-smoke2.html b/test/smoke/bind-smoke2.html new file mode 100644 index 0000000000..ff83d5ccbb --- /dev/null +++ b/test/smoke/bind-smoke2.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + diff --git a/test/unit/dom-bind-elements1.html b/test/unit/dom-bind-elements1.html index 0696569900..ce7c350808 100644 --- a/test/unit/dom-bind-elements1.html +++ b/test/unit/dom-bind-elements1.html @@ -7,4 +7,16 @@ } } }); + + + \ No newline at end of file diff --git a/test/unit/dom-bind.html b/test/unit/dom-bind.html index 2e7c2a6dd8..d6bdcdb86f 100644 --- a/test/unit/dom-bind.html +++ b/test/unit/dom-bind.html @@ -30,6 +30,8 @@
@@ -90,6 +92,11 @@ assert.equal(el1.computed, 50); }); + test('initial value notifies to dom-bind', function() { + assert.equal(domBind.z, 'a'); + assert.equal(z.textContent, 'a'); + }); + }); suite('imperative dom-bind', function() {