Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个解析错误selector时的问题. #2

Open
Leooonard opened this issue Jul 27, 2016 · 2 comments
Open

一个解析错误selector时的问题. #2

Leooonard opened this issue Jul 27, 2016 · 2 comments

Comments

@Leooonard
Copy link

错误selector的形式如下:

a,{
  padding: 10px
}

经解析后, 会形成如下的css dom.

[{
    "type": "rule",
    "selectors": ["a"],
    "declarations": {
        "{padding": "10"
    }
}]

可以看到padding属性前多了一个{, 其原因是Scanner.prototype.selector内没有为这种错误形式的css selector做兼容处理.

其结果是, 在a,{}后的所有样式失效. 原本浏览器可以自行解决的css写法错误, 在经过css dom的transform后, 成为了无法解决的css错误, 并且导致之后所有的css样式失效.

@Reedef
Copy link

Reedef commented Mar 17, 2017

先用插件验证一下 css 语法呗,要是考虑错误语法兼容太牵强了

@douzi8
Copy link
Owner

douzi8 commented Mar 18, 2017

好的,后面有空处理下,最近业务比较忙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants