Tuesday, 6 August 2013

Javascript: Why is classList not a property of Element.prototype

Javascript: Why is classList not a property of Element.prototype

Why is classList not a property of Element.prototype? Because elements
have a classList property, I would automatically assume it to be in the
element's prototype, But apparently it's not. So where is it?
Chrome's console:
> Element.prototype.classList
undefined
> document.createElement().classList
DOMTokenList

No comments:

Post a Comment