Skip to content

Commit 433f108

Browse files
committed
feat(parseBindings): Slice attributes instead of spread
1 parent 1e78822 commit 433f108

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/parsebindings/index.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ export default function parseBindings(object, givenNodes, eventOptions) {
8787
// initialize bindings for attributes if they appear
8888
if (attributes.length) {
8989
// fixes Firefox issue: attributes.length can be changed by processAttribute
90-
const attrs = attributes.length > 1 ? [...attributes] : attributes;
91-
nofn.forEach(attrs, (attribute) => {
92-
// Sometimes Webkit returns an attribute itself when attribute.value is accessed
93-
if (attribute.value && typeof attribute.value.value === 'string') {
94-
attribute = attribute.value; // eslint-disable-line no-param-reassign
95-
}
90+
const attrs = attributes.length > 1
91+
? Array.prototype.slice.call(attributes)
92+
: attributes;
9693

94+
nofn.forEach(attrs, (attribute) => {
9795
if (bindingReg.test(attribute.value)) {
9896
processAttribute({
9997
node,

test/spec/bindings/bindings_parser_spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ describe('Bindings parser', () => {
133133
expect(node.checked).toEqual(obj.x);
134134
});
135135

136+
it('should bind input=checkbox is not checked (bugfix)', () => {
137+
const node = parse('<input type="checkbox" checked="{{x}}">');
138+
const obj = {};
139+
140+
parseBindings(obj, node, noDebounceFlag);
141+
obj.x = false;
142+
expect(node.checked).toEqual(obj.x);
143+
});
144+
136145

137146
it('should bind textarea value', () => {
138147
const node = parse('<textarea value="{{x}}"></textarea>');

0 commit comments

Comments
 (0)