weixin_39605326 2020-11-30 15:19
浏览 0

CSS Errors in console printing out wrong text in second line of error

Originally reported on Google Code with ID 2388


CSS Errors in console printing out wrong text in second line of error. It
shows:

  Unknown property 'zoom'. Declaration dropped.
    issue-2388.html (line 5)

Where it should show:

  Unknown property 'zoom'. Declaration dropped.
   zoom:1 (line 5)

There is no real file name in this case since the CSS is added by JS. 

Test:


    
        <title>
            Testing CSS
        </title>
    
    
        <script>
            console.warn("Be sure to set Show CSS errors in the console! Test CSS
follows:")
            var cssText = "html {\n  height:100%;\n}\nbody{\n  zoom:1\n}\np{\n 
background-color:red;\n}";
            var cssTextByLine = cssText.split('\n'), c=cssTextByLine.length;
            for (var i=0; i<c; i++){
                console.log("%i: %s",i+1,cssTextByLine[i]);
            }
            console.warn("CSS errors: Line #s OK, not the lookup");
            var head = document.getElementsByTagName("head")[0];
            var rules = document.createElement("style");
            rules.setAttribute("type", "text/css");
            rules.appendChild(document.createTextNode(cssText));
            head.appendChild(rules);
            console.warn("The error related to zoom has the right line #, but shows
the line of the html file, not the css");
        </script>
        <p>Oh the fun of it all!</p>
    

Reported by sroussey on 2009-10-15 18:32:39

该提问来源于开源项目:firebug/firebug

  • 写回答

7条回答 默认 最新

  • weixin_39605326 2020-11-30 15:19
    关注

    Reported by kpdecker on 2009-10-16 23:17:42 - Status changed: Triaged - Labels added: Type-Defect, Test-case-available, console

    评论

报告相同问题?