cssClass.selectorText在firefox浏览器中发生更改

cssClass.selectorText change in firefox browsers

本文关键字:浏览器 selectorText firefox cssClass      更新时间:2023-09-26

im在firefox浏览器上尝试更改css类上的选择器文本时遇到问题。

我尝试过的:

for (var i = 0; i < document.styleSheets.length; i++) {
        styleSheet = document.styleSheets[i];
        for (var j = 0; j < styleSheet.cssRules.length; j++) {
            rule = styleSheet.cssRules[j];
            // identifies the keyframe rule bearing the same name as the class without the point in the beginning
            if ((rule.type == rule.KEYFRAMES_RULE || rule.type == rule.WEBKIT_KEYFRAMES_RULE) && rule.name === className.substr(1)) {
                keyframesRule = rule;
            }
            // identifies the class rule named like the function argument effect
            if (rule.selectorText == className) {
                animationRule = rule;
                mainSheet = styleSheet;
            }
        }
    }
for (var l = 0; l < nrOfElements; l++) {
        classAttributes = animationRule.cssText;
        mainSheet.insertRule(classAttributes, mainSheet.cssRules.length);
        newClasses = mainSheet.cssRules[mainSheet.cssRules.length - 1];
        newClasses.selectorText = newClassName[l];
        console.log(newClasses.selectorText);
        console.log(newClassName[l]);
        newClasses.style.setProperty((vendorPrefix + "animation-name"), newClassName[l].substr(1));
}

不幸的是,第一个控制台返回.WPANIM,而第二个返回.WPANIM + incrementor

问题:

为什么cssClass.selectorText在firefox浏览器上不能用其他东西更改?

Setting.selectorText未在Firefox中实现https://bugzilla.mozilla.org/show_bug.cgi?id=37468

这个问题自16年以来一直存在,请随时向左翼投票或解决它)