-
Notifications
You must be signed in to change notification settings - Fork 396
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
Attribute updateValue of undefined renders as value="undefined" #2944
Comments
That's a fair question. Does anyone know if there's a good way to detect string vs value attributes on a given element? I think at this point it's largely just hard coded around form elements. |
I thought every time node.setAttribute('attr-name', someVal) was called, the browser would always convert it to a string (except for special boolean, on/off attributes), so I'm not sure what your "string vs value attributes" distinction means. Note: it looks like updateValue() is the only update* method in this file that does not use the safeToStringValue() method: |
I suppose any non-input value attributes should probably just use |
Do you know of an example input whose "value" attribute is not a string? I thought the browser would put the non-string value in the input.value property but that input.getAttribute('value') would always return a string. MDN's docs on setAttribute() and getAttribute() sound like an element's attribute value is always a string (or sometimes null). This webcomponents issue was closed with this comment: "Attributes are strings. Making them something else would make them no longer attributes. You can use properties (and attributes that reflect them) to store other data." |
Before making any assumptions, there might be some insight on the PR that added the line https://github.com/ractivejs/ractive/pull/2022/files |
I was conflating the value property and value attribute a bit. I think it's safe to say that we can change |
Sounds great, thanks! |
Description:
Why is the default updateDelegate for a "value" attribute updateValue() instead of updateStringValue()? This causes problems with a keypath whose value is undefined, since that is rendered as value="undefined".
Versions affected:
0.9 build 120
Platforms affected:
all
Reproduction:
https://jsfiddle.net/c4nay9me/
Code:
The text was updated successfully, but these errors were encountered: