mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
2.5 KiB
JSON
1 line
2.5 KiB
JSON
|
{"ast":null,"code":"function replaceClassName(origClass, classToRemove) {\n return origClass.replace(new RegExp(\"(^|\\\\s)\" + classToRemove + \"(?:\\\\s|$)\", 'g'), '$1').replace(/\\s+/g, ' ').replace(/^\\s*|\\s*$/g, '');\n}\n/**\n * Removes a CSS class from a given element.\n * \n * @param element the element\n * @param className the CSS class name\n */\n\n\nexport default function removeClass(element, className) {\n if (element.classList) {\n element.classList.remove(className);\n } else if (typeof element.className === 'string') {\n element.className = replaceClassName(element.className, className);\n } else {\n element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));\n }\n}","map":{"version":3,"sources":["/app/node_modules/dom-helpers/esm/removeClass.js"],"names":["replaceClassName","origClass","classToRemove","replace","RegExp","removeClass","element","className","classList","remove","setAttribute","baseVal"],"mappings":"AAAA,SAASA,gBAAT,CAA0BC,SAA1B,EAAqCC,aAArC,EAAoD;AAClD,SAAOD,SAAS,CAACE,OAAV,CAAkB,IAAIC,MAAJ,CAAW,YAAYF,aAAZ,GAA4B,WAAvC,EAAoD,GAApD,CAAlB,EAA4E,IAA5E,EAAkFC,OAAlF,CAA0F,MAA1F,EAAkG,GAAlG,EAAuGA,OAAvG,CAA+G,YAA/G,EAA6H,EAA7H,CAAP;AACD;AACD;AACA;AACA;AACA;AACA;AACA;;;AAGA,eAAe,SAASE,WAAT,CAAqBC,OAArB,EAA8BC,SAA9B,EAAyC;AACtD,MAAID,OAAO,CAACE,SAAZ,EAAuB;AACrBF,IAAAA,OAAO,CAACE,SAAR,CAAkBC,MAAlB,CAAyBF,SAAzB;AACD,GAFD,MAEO,IAAI,OAAOD,OAAO,CAACC,SAAf,KAA6B,QAAjC,EAA2C;AAChDD,IAAAA,OAAO,CAACC,SAAR,GAAoBP,gBAAgB,CAACM,OAAO,CAACC,SAAT,EAAoBA,SAApB,CAApC;AACD,GAFM,MAEA;AACLD,IAAAA,OAAO,CAACI,YAAR,CAAqB,OAArB,EAA8BV,gBAAgB,CAACM,OAAO,CAACC,SAAR,IAAqBD,OAAO,CAACC,SAAR,CAAkBI,OAAvC,IAAkD,EAAnD,EAAuDJ,SAAvD,CAA9C;AACD;AACF","sourcesContent":["function replaceClassName(origClass, classToRemove) {\n return origClass.replace(new RegExp(\"(^|\\\\s)\" + classToRemove + \"(?:\\\\s|$)\", 'g'), '$1').replace(/\\s+/g, ' ').replace(/^\\s*|\\s*$/g, '');\n}\n/**\n * Removes a CSS class from a given element.\n * \n * @param element the element\n * @param className the CSS class name\n */\n\n\nexport default function removeClass(element, className) {\n if (element.classList) {\n element.classList.remove(className);\n } else if (typeof element.className === 'string') {\n element.className = replaceClassName(element.className, className);\n } else {\n element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));\n }\n}"]},"metadata":{},"sourceType":"module"}
|