cssRules对象缺少CSS规则

时间:2018-08-08 12:06:01

标签: html css

我有一条“样式”元素,其规则如下:

#canvas {
    position:absolute;
    z-index:100;
    left:0;
    top:0;
    background-color: none;
    border: none;
    width:300px;
    height:250px;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    overflow:hidden;
}

现在我是否要通过以下方式访问其CSS规则:

StyleElem.sheet.cssRules[0].cssText

我得到:

#canvas { position: absolute; z-index: 100; left: 0px; top: 0px; border: none; width: 300px; height: 250px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); overflow: hidden; }

现在您可以看到一些规则消失了,例如: 背景颜色 -moz-user-select:无; -webkit-user-select:无; ........ 知道为什么吗?以及如何解决?

0 个答案:

没有答案