function hasClassName(elem, cl) { return (new RegExp('(^|\s)' + cl + '(\s|$)')).test(elem.className); }