Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Parse base64 encoded images.

  • Loading branch information...
commit bce97797aa2ae51bb4e7690f36a437a148a59b7e 1 parent d7ac379
@NV authored
Showing with 28 additions and 0 deletions.
  1. +13 −0 lib/parse.js
  2. +15 −0 test/parse.test.js
View
13 lib/parse.js
@@ -158,6 +158,19 @@ CSSOM.parse = function parse(token, options) {
}
break;
+ case '(':
+ if (state == 'value') {
+ index = token.indexOf(')', i + 1);
+ if (index == -1) {
+ throw i + ': unclosed "("';
+ }
+ buffer += token.slice(i, index + 1);
+ i = index;
+ } else {
+ buffer += character;
+ }
+ break;
+
case "!":
if (state == "value" && token.indexOf("!important", i) === i) {
priority = "important";
View
15 test/parse.test.js
@@ -282,6 +282,21 @@ var TESTS = [
}
},
{
+ input: 'img:not(/*)*/[src]){background:url(data:image/png;base64,FooBar)}',
+ result: {
+ cssRules: [
+ {
+ selectorText: 'img:not([src])',
+ style: {
+ 0: 'background',
+ background: 'url(data:image/png;base64,FooBar)',
+ length: 1
+ }
+ }
+ ]
+ }
+ },
+ {
input: "@media handheld, only screen and (max-device-width: 480px) {body{max-width:480px}}",
result: {
cssRules: [

0 comments on commit bce9779

Please sign in to comment.
Something went wrong with that request. Please try again.