Permalink
Browse files

Merge pull request #136 from TooTallNate/add/prefix-selectors-root-su…

…pport

prefix-selectors: add support for :root pseudo-class
  • Loading branch information...
2 parents 33e2c11 + 6b62f2f commit ae58502ef4e6462e4080baff8b7bdf76a83c6093 @jonathanong jonathanong committed Jan 2, 2014
@@ -19,9 +19,11 @@ module.exports = function(str) {
style.rules = style.rules.map(function(rule){
if (!rule.selectors) return rule;
rule.selectors = rule.selectors.map(function(selector){
+ if (':root' == selector) return str;
+ selector = selector.replace(/^\:root\s?/, '');
return str + ' ' + selector;
});
return rule;
});
}
-};
+};
@@ -0,0 +1,11 @@
+:root {
+ bar: 'baz';
+}
+
+:root foo {
+ color: #f00;
+}
+
+bar {
+ font-family: "Wingdings";
+}
@@ -0,0 +1,11 @@
+#dialog {
+ bar: 'baz';
+}
+
+#dialog foo {
+ color: #f00;
+}
+
+#dialog bar {
+ font-family: "Wingdings";
+}
View
@@ -219,6 +219,12 @@ describe('rework', function(){
.toString()
.should.equal(fixture('prefix-selectors.out'));
})
+ it('should use the prefix as the :root pseudo-class', function(){
+ rework(fixture('prefix-selectors-root'))
+ .use(rework.prefixSelectors('#dialog'))
+ .toString()
+ .should.equal(fixture('prefix-selectors-root.out'));
+ })
})
describe('.url(fn)', function(){

0 comments on commit ae58502

Please sign in to comment.