Having Trouble Understanding Classie.js Api
Hello all I'm working through an example of a slide and push menu on another site and am struggling to understand an if statement in the classie.js file that is included with the s
Solution 1:
Newer browsers support a .classList
property on DOM element nodes. It's an array of class names. Older browsers just support the .className
property, which is a single string containing space-separated class names.
If the if
statement in the code you posted sees that the document node has a .classList
property, it knows that it's running on a newer browser. If not, then it creates alternative versions of some class management utilities.
Solution 2:
'classList' in document.documentElement
simply checks for the existence of classList
within the document.documentElement
Element.
From MDN's documentation on the in
operator.
The
in
operator returns true if the specified property is in the specified object.
Post a Comment for "Having Trouble Understanding Classie.js Api"