List of usage examples for org.w3c.dom.stylesheets MediaList getLength
public int getLength();
From source file:com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.java
/** * Returns whether the specified {@link MediaList} is active or not. * @param scriptable the scriptable/*from w w w .j a va 2 s.c o m*/ * @param mediaList the media list * @return whether the specified {@link MediaList} is active or not */ static boolean isActive(final SimpleScriptable scriptable, final MediaList mediaList) { if (mediaList.getLength() == 0) { return true; } for (int i = 0; i < mediaList.getLength(); i++) { final MediaQuery mediaQuery = ((MediaListImpl) mediaList).mediaQuery(i); boolean isActive = isActive(scriptable, mediaQuery); if (mediaQuery.isNot()) { isActive = !isActive; } if (isActive) { return true; } } return false; }