You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function getByClass(cName) {
if ('getElementsByClassName' in this) {
return this.getElementsByClassName(cName);
}
cName = cName.replace(/(^\s+|\s+$)/g, '').split(/\s+/g);
let eles = this.getElementsByTagName('*');
for (let i = 0; i < cName.length; i++) {
let reg = new RegExp(`(^| )${cName[i]}( |$)`);
let temp = [];
for (let j = 0; j < eles.length; j++) {
let cur = eles[j];
let {className} = cur;
if (reg.test(className)) {
temp.push(cur);
}
}
eles = temp;
}
return eles;
}
console.log(content.getByClass('c1 c2 '));
The text was updated successfully, but these errors were encountered:
throttle
debounce
simple promise
cancel promise
array flatten
getElementsByClassName
The text was updated successfully, but these errors were encountered: