MCPcopy Create free account
hub / github.com/NVlabs/SPADE / getElem

Function getElem

docs/lib.js:156–166  ·  view source on GitHub ↗
(elem)

Source from the content-addressed store, hash-verified

154// DOM
155
156function getElem(elem) {
157 if (document.getElementById) {
158 if (typeof elem == "string") {
159 elem = document.getElementById(elem);
160 if (elem===null) throw 'cannot get element: element does not exist';
161 } else if (typeof elem != "object") {
162 throw 'cannot get element: invalid datatype';
163 }
164 } else throw 'cannot get element: unsupported DOM';
165 return elem;
166}
167
168function hasClass(elem, className) {
169 return getElem(elem).className.split(' ').has(className);

Callers 3

hasClassFunction · 0.85
getElementsByClassFunction · 0.85
listenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected