Skip to content

Commit

Permalink
Fix wrongly merging of pseudo class and element with the same name (f…
Browse files Browse the repository at this point in the history
…ixes #383)
  • Loading branch information
lahmatiy committed Oct 27, 2020
1 parent c45c173 commit ba7952c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## next

- Bumped [CSSTree](https://github.com/csstree/csstree) to `^1.0.0`
- Fixed wrong merging of TRBL values when one of them contains `var()` (#420)
- Fixed wrongly merging of TRBL values when one of them contains `var()` (#420)
- Fixed wrongly merging of pseudo class and element with the same name, e.g. `:-ms-input-placeholder` and `::-ms-input-placeholder` (#383)

## 4.0.3 (March 24, 2020)

Expand Down
4 changes: 2 additions & 2 deletions lib/restructure/prepare/processSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = function freeze(node, usageData) {
var name = node.name.toLowerCase();

if (!nonFreezePseudoClasses.hasOwnProperty(name)) {
pseudos[name] = true;
pseudos[':' + name] = true;
hasPseudo = true;
}
break;
Expand All @@ -53,7 +53,7 @@ module.exports = function freeze(node, usageData) {
var name = node.name.toLowerCase();

if (!nonFreezePseudoElements.hasOwnProperty(name)) {
pseudos[name] = true;
pseudos['::' + name] = true;
hasPseudo = true;
}
break;
Expand Down
15 changes: 15 additions & 0 deletions test/fixture/compress/placeholder-pseudo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.class::-webkit-input-placeholder {
color: red;
}

.class::-ms-input-placeholder {
color: red;
}

.class:-ms-input-placeholder {
color: red;
}

.class::placeholder {
color: red;
}
1 change: 1 addition & 0 deletions test/fixture/compress/placeholder-pseudo.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.class::-webkit-input-placeholder{color:red}.class::-ms-input-placeholder{color:red}.class:-ms-input-placeholder{color:red}.class::placeholder{color:red}

0 comments on commit ba7952c

Please sign in to comment.