Skip to content

Commit

Permalink
Removed auto-prefixing of pseudo element selectors. Closes stylus#385
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 1, 2011
1 parent f78a6f8 commit cba7940
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 42 deletions.
22 changes: 1 addition & 21 deletions lib/visitor/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,33 +145,13 @@ Evaluator.prototype.evaluate = function(){
*/

Evaluator.prototype.visitGroup = function(group){
var vendors = this.vendors
, selectors = []
, re = /::(?!-)([-\w]+)/;
var vendors = this.vendors;

group.nodes = group.nodes.map(function(selector){
selector.val = this.interpolate(selector);
if (~selector.val.indexOf('::')) {
if (re.exec(selector.val)) {
var name = RegExp.$1;
vendors.forEach(function(prefix){
if ('official' == prefix) return;
var old = '::' + name
, vendor = '::-' + prefix + '-' + name
, val = selector.val.replace(old, vendor);
selectors.push(val);
});
}
}
return selector;
}, this);

selectors.forEach(function(val){
var sel = new nodes.Selector;
sel.val = val;
group.push(sel);
});

group.block = this.visit(group.block);
return group;
};
Expand Down
27 changes: 6 additions & 21 deletions test/cases/selectors.pseudo.elements.css
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
input::selection,
input::focus-inner,
input::-moz-selection,
input::-webkit-selection,
input::-moz-focus-inner,
input::-webkit-focus-inner {
input::focus-inner {
border: 0;
padding: 0;
}
input::-moz-selection {
border: 0;
}
p,
::selection,
::-moz-selection,
::-webkit-selection {
::selection {
background: #000;
}
::selection,
::-moz-selection,
::-webkit-selection {
::selection {
background: #000;
}
p::selection,
a::selection,
p::-moz-selection,
p::-webkit-selection,
a::-moz-selection,
a::-webkit-selection {
a::selection {
background: #000;
}
p::selection,
p::-moz-selection,
p::-webkit-selection {
p::selection {
color: #fff;
background: #000;
}
body ::selection,
body ::-webkit-selection {
body ::selection {
color: #fff;
}

0 comments on commit cba7940

Please sign in to comment.