cssom-papandreou
Advanced tools
Comparing version 0.2.4-patch5 to 0.2.4-patch6
@@ -12,3 +12,4 @@ //.CommonJS | ||
CSSKeyframeRule: require('./CSSKeyframeRule').CSSKeyframeRule, | ||
CSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule | ||
CSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule, | ||
CSSDocumentRule: require('./CSSDocumentRule').CSSDocumentRule | ||
}; | ||
@@ -45,3 +46,4 @@ ///CommonJS | ||
"importRule": true, | ||
"atBlock": true | ||
"atBlock": true, | ||
'documentRule-begin': true | ||
}; | ||
@@ -51,9 +53,9 @@ | ||
// @type CSSStyleSheet|CSSMediaRule|CSSFontFaceRule|CSSKeyframesRule | ||
// @type CSSStyleSheet|CSSMediaRule|CSSFontFaceRule|CSSKeyframesRule|CSSDocumentRule | ||
var currentScope = styleSheet; | ||
// @type CSSMediaRule|CSSKeyframesRule | ||
// @type CSSMediaRule|CSSKeyframesRule|CSSDocumentRule | ||
var parentRule; | ||
var selector, name, value, priority="", styleRule, mediaRule, importRule, fontFaceRule, keyframesRule, keyframeRule, hostRule; | ||
var selector, name, value, priority="", styleRule, mediaRule, importRule, fontFaceRule, keyframesRule, keyframeRule, hostRule, documentRule; | ||
@@ -149,3 +151,10 @@ var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g; | ||
case "@": | ||
if (token.indexOf("@media", i) === i) { | ||
if (token.indexOf("@-moz-document", i) === i) { | ||
state = "documentRule-begin"; | ||
documentRule = new CSSOM.CSSDocumentRule; | ||
documentRule.__starts = i; | ||
i += "-moz-document".length; | ||
buffer = ""; | ||
break; | ||
} else if (token.indexOf("@media", i) === i) { | ||
state = "atBlock"; | ||
@@ -234,2 +243,12 @@ mediaRule = new CSSOM.CSSMediaRule; | ||
state = "before-name"; | ||
} else if (state === "documentRule-begin") { | ||
// FIXME: what if this '{' is in the url text of the match function? | ||
documentRule.matcher.matcherText = buffer.trim(); | ||
if (parentRule) { | ||
documentRule.parentRule = parentRule; | ||
} | ||
currentScope = parentRule = documentRule; | ||
documentRule.parentStyleSheet = styleSheet; | ||
buffer = ""; | ||
state = "before-selector"; | ||
} | ||
@@ -359,3 +378,3 @@ break; | ||
case "selector": | ||
// End of media rule. | ||
// End of media/document rule. | ||
if (!parentRule) { | ||
@@ -362,0 +381,0 @@ parseError("Unexpected }"); |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.2.4-patch5", | ||
"version": "0.2.4-patch6", | ||
"homepage": "https://github.com/NV/CSSOM", | ||
@@ -13,0 +13,0 @@ "author": "Nikita Vasilyev <me@elv1s.ru>", |
40334
21
1310