Files
codeql/javascript/ql/src/Expressions/DOMProperties.qll
2019-01-07 10:15:45 +00:00

19 lines
545 B
Plaintext

/**
* Provides predicates for working with the DOM type hierarchy.
*/
import semmle.javascript.Externs
/** Holds if `et` is a root interface of the DOM type hierarchy. */
predicate isDOMRootType(ExternalType et) {
exists(string n | n = et.getName() | n = "EventTarget" or n = "StyleSheet")
}
/** Holds if `p` is declared as a property of a DOM class or interface. */
pragma[nomagic]
predicate isDOMProperty(string p) {
exists(ExternalMemberDecl emd | emd.getName() = p |
isDOMRootType(emd.getDeclaringType().getASupertype*())
)
}