Chrome浏览器的一个不小的bug

Posted on October 08, 2008 by Fdream

今天在玩JavaScript的语法高亮,弄得差不多了在Firefox 3和IE 7下都正常了,最后想看看Chrome下是不是正常,结果打开我的测试页面,除了在前面的一部分文字显示出来以外,页面剩余部分居然是一片空白!

很诡异的用chrome打开源代码看(因为有语法高亮,很容易知道问题出在哪),结果很明显,我的js中有这么一句:

this.ignore = '<!--';

在源代码查看器中显示,Chrome从这个注释字符串开始,把后面的都当成注释了,偏偏我后面的js里面还有这么一行:

this.commentOff = '-->';

由于这一段js被chrome认为是注释,以致页面不能正常解析,所以这个字符串前面的HTML代码能够正常工作,而这个后面的就不行了……

不过有一个解决办法,就是把这段js写在外部文件中就没这个问题了^_^

分享 |
Categories:
Ajax Web
Tags:
, ,
Comments:
Leave a comment
Views:
1,026 Views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>