Skip to content

css-has-pseudo #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/test/basic.ch38.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/test/basic.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/test/basic.ff49.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/test/basic.ff66.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/test/basic.ie10.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)] {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
order: 3;
}

[\:has\(.a\)] {
[csstools-has-1m-2w-2p-37-14-1a-2p-15] {
order: 4;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
order: 3;
}

[\:has\(.a\)] {
[csstools-has-1m-2w-2p-37-14-1a-2p-15] {
order: 4;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ input:blank {
order: 1;
}

a[\:has\(\%3E\%20img\)] {
[csstools-has-2p-1m-2w-2p-37-14-1q-w-2x-31-2v-15]:not(does-not-exist):not(does-not-exist) {
order: 2;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ h1.test-custom-selectors:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):n
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)]:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#) {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#) {
background-color: yellow;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ h1.test-custom-selectors:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):n
background-color: yellow;
}

.test-has-pseudo-class[\:has\(.inner-class\)]:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#) {
[csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#) {
background-color: yellow;
}

Expand Down
10 changes: 1 addition & 9 deletions plugins/css-has-pseudo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
node_modules
dist
package-lock.json
yarn.lock
browser.js
!src/browser.js
*.log*
*.result.css
*.result.css.map
!.editorconfig
!.gitignore
!.rollup.js
!.tape.js
!.travis.yml
dist/*
58 changes: 57 additions & 1 deletion plugins/css-has-pseudo/.tape.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import postcssTape from '../../packages/postcss-tape/dist/index.mjs';
import plugin from 'css-has-pseudo';
import postcssLogical from 'postcss-logical';
import postcssNesting from 'postcss-nesting';
import postcssDirPseudoClass from 'postcss-dir-pseudo-class';

postcssTape(plugin)({
'basic': {
Expand All @@ -11,11 +14,64 @@ postcssTape(plugin)({
preserve: false
}
},
'basic:specificity-matching-name': {
message: 'supports { specificityMatchingName: "other-thing-that-does-not-exist" } usage',
options: {
specificityMatchingName: 'other-thing-that-does-not-exist'
}
},
'examples/example': {
message: 'minimal example',
},
'examples/example:preserve-false': {
message: 'minimal example',
options: {
preserve: false
}
},
'generated-selector-cases': {
message: 'correctly handles generated cases',
warnings: 1,
options: {
preserve: false
}
},
})
'browser': {
message: 'prepare CSS for chrome test',
options: {
preserve: false
}
},
'plugin-order-logical:before': {
message: 'works with other plugins that modify selectors',
plugins: [postcssLogical({ preserve: false }), postcssDirPseudoClass({ preserve: false }), plugin({ preserve: false })],
},
'plugin-order-logical:after': {
message: 'works with other plugins that modify selectors',
plugins: [plugin({ preserve: false }), postcssLogical({ preserve: false }), postcssDirPseudoClass({ preserve: false })],
},
'plugin-order-logical:before:preserve': {
message: 'works with other plugins that modify selectors',
plugins: [postcssLogical({ preserve: true }), postcssDirPseudoClass({ preserve: true }), plugin({ preserve: true })],
},
'plugin-order-logical:after:preserve': {
message: 'works with other plugins that modify selectors',
plugins: [plugin({ preserve: true }), postcssLogical({ preserve: true }), postcssDirPseudoClass({ preserve: true })],
},
'plugin-order-nesting:before': {
message: 'works with other plugins that modify selectors',
plugins: [postcssNesting({ preserve: false }), plugin({ preserve: false })],
},
'plugin-order-nesting:after': {
message: 'works with other plugins that modify selectors',
plugins: [postcssNesting({ preserve: false }), plugin({ preserve: false })],
},
'plugin-order-nesting:before:preserve': {
message: 'works with other plugins that modify selectors',
plugins: [plugin({ preserve: true }), postcssNesting({ preserve: true })],
},
'plugin-order-nesting:after:preserve': {
message: 'works with other plugins that modify selectors',
plugins: [plugin({ preserve: true }), postcssNesting({ preserve: true })],
}
});
27 changes: 27 additions & 0 deletions plugins/css-has-pseudo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changes to CSS Has Pseudo

### Unreleased (major)

[Read the full changelog](https://github.com/csstools/postcss-plugins/wiki/PostCSS-Preset-Env-8)

- Breaking: removed old CDN urls
- Added: 'hover' options for browser polyfill
- Added: 'observedAttributes' options for browser polyfill
- Added: 'forcePolyfill' options for browser polyfill
- Added: Rules within `@supports selector(:has(something))` won't be transformed.
- Fix: Use base36 encoding to support all possible selectors.

#### How to migrate :

##### Re-build your CSS with the new version of the library.

##### If you use a CDN url, please update it.

```diff
- <script src="https://unpkg.com/css-has-pseudo/browser"></script>
+ <script src="https://unpkg.com/css-has-pseudo/dist/browser-global.js"></script>
```

```diff
- <script src="https://unpkg.com/css-has-pseudo/browser.min"></script>
+ <script src="https://unpkg.com/css-has-pseudo/dist/browser-global.js"></script>
```

### 3.0.4 (February 5, 2022)

- Rebuild of browser polyfills
Expand Down
Loading