Skip to content

Commit 13e5e6e

Browse files
committed
Merge pull request #2099 from Polymer/fix-2098
Fixes #2098
2 parents 3d56eb0 + 1a5c391 commit 13e5e6e

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

src/standard/configure.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@
4545

4646
// storage for configuration
4747
_setupConfigure: function(initialConfig) {
48-
this._config = initialConfig || {};
48+
this._config = {};
49+
// don't accept undefined values in intialConfig
50+
for (var i in initialConfig) {
51+
if (initialConfig[i] !== undefined) {
52+
this._config[i] = initialConfig[i];
53+
}
54+
}
4955
this._handlers = [];
5056
},
5157

@@ -92,6 +98,7 @@
9298
_configureProperties: function(properties, config) {
9399
for (var i in properties) {
94100
var c = properties[i];
101+
// don't accept undefined values
95102
if (c.value !== undefined) {
96103
var value = c.value;
97104
if (typeof value == 'function') {

test/smoke/bind-smoke2.html

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!doctype html>
2+
<!--
3+
@license
4+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
5+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8+
Code distributed by Google as part of the polymer project is also
9+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10+
-->
11+
<link rel="import" href="../../polymer.html">
12+
13+
<body>
14+
15+
<dom-module is="data-source">
16+
<template>
17+
<span>{{prop}}</span>
18+
<span>{{data.length}}</span>: length
19+
<br>
20+
21+
<template is="dom-repeat" items="{{data}}">
22+
<span>{{item}}</span>
23+
</template>:items
24+
</template>
25+
</dom-module>
26+
27+
28+
<script>
29+
Polymer({
30+
is: 'data-source',
31+
32+
properties: {
33+
data: {
34+
//readOnly: true,
35+
notify: true,
36+
type: Array,
37+
value: [1, 2, 3]
38+
},
39+
40+
prop: {
41+
readOnly: true,
42+
notify: true,
43+
type: String,
44+
value: 'foo'
45+
}
46+
}
47+
});
48+
</script>
49+
50+
51+
<template is="dom-bind">
52+
53+
<h1>Element</h1>
54+
<data-source data="{{data}}" prop="{{prop}}"></data-source>
55+
56+
<h1>Databound</h1>
57+
58+
<span>{{prop}}</span>
59+
60+
<template is="dom-repeat" items="{{data}}">
61+
<span>{{item}}</span>
62+
</template>
63+
64+
</template>
65+
66+
67+
68+
</body>

test/unit/dom-bind-elements1.html

+12
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,16 @@
77
}
88
}
99
});
10+
</script>
11+
12+
<script>
13+
Polymer({
14+
is: 'x-produce-a',
15+
properties: {
16+
a: {
17+
notify: true,
18+
value: 'a'
19+
}
20+
}
21+
});
1022
</script>

test/unit/dom-bind.html

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<template is="dom-bind" id="decDomBind">
3131
<x-basic id="decEl1" value="{{value}}" notifyingvalue="{{nvalue}}" on-custom="handleEvent" computed="{{compute(dep)}}"></x-basic>
3232
<x-basic id="decEl2" value="{{value}}" notifyingvalue="{{nvalue}}"></x-basic>
33+
<x-produce-a a={{z}}></x-produce-a>
34+
<div id="z">{{z}}</div>
3335
</template>
3436

3537
<div id="container">
@@ -90,6 +92,11 @@
9092
assert.equal(el1.computed, 50);
9193
});
9294

95+
test('initial value notifies to dom-bind', function() {
96+
assert.equal(domBind.z, 'a');
97+
assert.equal(z.textContent, 'a');
98+
});
99+
93100
});
94101

95102
suite('imperative dom-bind', function() {

0 commit comments

Comments
 (0)