Permalink
Browse files

Merge branch 'gh-pages' of github.com:NV/CSSOM into gh-pages

  • Loading branch information...
NV committed Jun 23, 2011
2 parents 996af72 + 11ed94b commit d49541a54827edbff33152ab3564641b3848e63d
Showing with 57 additions and 3 deletions.
  1. +2 −1 lib/CSSImportRule.js
  2. +7 −2 lib/parse.js
  3. +48 −0 test/parse.test.js
View
@@ -22,7 +22,8 @@ CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule;
CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
CSSOM.CSSImportRule.prototype.type = 3;
CSSOM.CSSImportRule.prototype.__defineGetter__("cssText", function() {
return "@import url("+ this.href +") "+ this.media.mediaText +";"
var mediaText = this.media.mediaText;
return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";";
});
CSSOM.CSSImportRule.prototype.__defineSetter__("cssText", function(cssText) {
View
@@ -72,8 +72,13 @@ CSSOM.parse = function parse(token, options) {
}
buffer += token.slice(i, index);
i = index - 1;
if (state == 'before-value') {
state = 'value';
switch (state) {
case 'before-value':
state = 'value';
break;
case 'importRule-begin':
state = 'importRule';
break;
}
break;
View
@@ -480,6 +480,54 @@ var TESTS = [
}
]
}
},
{
input: '@import "partial.css";\ni {font-style: italic}',
result: {
cssRules: [
{
href: 'partial.css',
media: {
length: 0
},
styleSheet: {
cssRules: []
}
},
{
selectorText: "i",
style: {
0: 'font-style',
'font-style': 'italic',
length: 1
}
}
]
}
},
{
input: "@import 'partial.css';\ni {font-style: italic}",
result: {
cssRules: [
{
href: 'partial.css',
media: {
length: 0
},
styleSheet: {
cssRules: []
}
},
{
selectorText: "i",
style: {
0: 'font-style',
'font-style': 'italic',
length: 1
}
}
]
}
}
];

0 comments on commit d49541a

Please sign in to comment.