Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data-model] IE puts [object HTMLInputElement] when encountering this scenario #1

Open
bingzer opened this issue Feb 5, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@bingzer
Copy link
Owner

bingzer commented Feb 5, 2021

[global vars]

var employee = {
 ...
}
var candyTypes = [
 ...
]

[html]


<select data-model="employee.candyType" data-attrs="{disabled: !employee.wantCandy}">
 <option data-foreach="candy in candyTypes" data-attrs="{value: candy}" data-model="candy"></option>
</select>

...

<label data-foreach="candy in candyTypes" style="border: 1px solid gray">
 <input data-model="employee.candyType" type="radio" data-attrs="{name: 'candy', value: candy2, checked: employee.candyType == candy2, disabled: !employee.wantCandy}">
 <span data-model="candy2"></span>
</label>

When clicking on [input=radio]. The option on the select will have value=[HTMLInputElement] rather than the actual value of the selected candy on the [input=radio].

The issue causes by having attribute 'name' on the option element with the same name as the scope variable.

Debugged the whole thing, turned out IE created a global variable named candy with a value of '[HTMLInputElement]'. This causes the option value to be '[HTMLInputElement'] Could not find a code that does this.

: data-foreach.ts:48

@bingzer bingzer added the bug Something isn't working label Feb 5, 2021
bingzer added a commit that referenced this issue Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant