NV / CSSOM

Unmaintained! ⚠️ CSS Object Model implemented in pure JavaScript. Also, a CSS parser.
https://nv.github.io/CSSOM/docs/parse.html
MIT License
751 stars 99 forks source link

Unescaped brackets in data URLs in quoted CSS attrs cause parse error #77

Closed stuartlangridge closed 8 years ago

stuartlangridge commented 8 years ago
var CSSOM = require("cssom")
var rule = "p { background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Crect%20fill%3D%22url(%23a)%22/%3E%3C/svg%3E'); }";
var ast = CSSOM.parse(rule);

throws error: Unmatched ' (line 1, char 141)

This is, arguably, OK to not parse; the data URL contains unescaped bracket characters. However, throwing a final error and terminating the parse is a bit unfriendly. This is likely caused by the parser jumping ahead from the ( to the next ) without checking for more opening brackets in the intervening space.

papandreou commented 8 years ago

Duplicate of https://github.com/NV/CSSOM/issues/56