Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
RadioNodeList polyfill
/*
demo :- http://jsfiddle.net/bjkkD/20/
Implements RadioNodeList :- http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#radionodelist
Implementation just adds `.value` as a property to `NodeList`.
Requires ES5 shim and ES5 shimmable browser. (Modern and IE8)
*/
;(function () {
Object.defineProperty(NodeList.prototype, "value", {
get: getRadioNodeListValue,
set: setRadioNodeListValue,
configurable: true
});
function getRadioNodeListValue() {
for (var i = 0, len = this.length; i < len; i++) {
var el = this[i];
if (el.checked) {
return el.value;
}
}
}
function setRadioNodeListValue(value) {
for (var i = 0, len = this.length; i < len; i++) {
var el = this[i];
if (el.checked) {
el.value = value;
return;
}
}
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.