Serializable property is defined as:
- When you set a property of the element, it will be reflected in serialization queries such as
getAttribute
and you can see the changes in DOM Inspector - When you get the
.innerHTML
of the element's parentnode, the returned html string will contain all the serializable properties as their attribute counterparts
I have made a page that looks like it's reliably printing a table of all serializable properties of the input
element in Chrome and Firefox: http://jsfiddle.net/tEVLp/16/.
Custom properties are never serializable, so in firefox webkitSpeech
etc are not serializable. Test in chrome for best results.
All booleans are true
because serialization of a false
property would be the absence of the attribute which is a false negative in the test.
So my question is, why are not properties such as .value
and .checked
serializable?
Technically, both are serializable. .value
is just a string and the browser has no problems with serializing other boolean properties, such as .readOnly
and .disabled
.
My best guess is that since .defaultValue
serializes to "value"
-attribute and .defaultChecked
serializes to "checked"
-attribute, there would be a conflict and thus the
.value
and .checked
cannot be serialized. In that case, why are the defaultX
ones chosen for these and not the ones that reflect the more useful current .value
and .checked
states?