📅  最后修改于: 2022-03-11 14:57:11.184000             🧑  作者: Mango
var listClasses = function( pattern ){
var allClassesTmp = {}, allClasses = [];
var rx = pattern ? (new RegExp(pattern)) : (new RegExp(".*"));
$('*[class]').each( function(){
var cn = this.className.split(/\s+/);
for(var i=cn.length;--i>-1;){
if(rx.test(cn[i]))allClassesTmp[ cn[i] ] = 1
}
});
for(var i in allClassesTmp)allClasses.push(i);
return allClasses;
}