Skip to content
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

fix: fixed merging of unsupported pseudos by caniuse and browserlist #883

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

anikethsaha
Copy link
Member

This change won't merge rules (having pseudo-classes) which are not either supported by caniuse in browserlist 's browsers.

The bug was even they were not supported, the compatibility was not changed which leads to false merging.

@codecov-io
Copy link

codecov-io commented Feb 23, 2020

Codecov Report

Merging #883 into master will decrease coverage by 0.2%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
- Coverage   97.27%   97.07%   -0.21%     
==========================================
  Files         118      118              
  Lines        3452     3454       +2     
  Branches     1036     1037       +1     
==========================================
- Hits         3358     3353       -5     
- Misses         86       93       +7     
  Partials        8        8
Impacted Files Coverage Δ
...postcss-merge-rules/src/lib/ensureCompatibility.js 100% <100%> (ø) ⬆️
packages/postcss-merge-rules/src/index.js 93.67% <0%> (-4.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd7b878...f51afea. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, what is changed in snapshots?

@anikethsaha
Copy link
Member Author

anikethsaha commented Feb 25, 2020

Integration fixtures. there where some of the places in the framework fixtures where it was merging unsupported rules.

Output of yarn run build:integration

@alexander-akait
Copy link
Member

Can you look on snapshot changes, and write them here (no need all, just couple)

@anikethsaha
Copy link
Member Author

anikethsaha commented Feb 25, 2020

for cancise.css


It didnt merge the ::-webkit-slider-thumb selector (not supported from caniuse in browserlist 's default env)

image

image


gumpy.css


:visited not supported by us. not in the list here

image

@alexander-akait
Copy link
Member

Can we fix visited here?

@anikethsaha
Copy link
Member Author

Can we fix visited here?

I will surely fix it , but I dont know the name for caniuse to search it.

I tried
:visited
visited
css-visited

but for all of these, caniuse api is return error with cannot find name ...

image

image

image

image

Do you know the feature name for this. ?

@alexander-akait
Copy link
Member

https://caniuse.com/#feat=mdn-css_selectors_visited, think we should try css_selectors_visited

@anikethsaha
Copy link
Member Author

no luck

image

@alexander-akait
Copy link
Member

I will look on visited in near future

@anikethsaha
Copy link
Member Author

cc @evilebottnawi

@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2020

Codecov Report

Merging #883 into master will decrease coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
- Coverage   97.28%   97.12%   -0.16%     
==========================================
  Files         118      119       +1     
  Lines        3458     3479      +21     
  Branches     1040     1048       +8     
==========================================
+ Hits         3364     3379      +15     
- Misses         86       92       +6     
  Partials        8        8              
Impacted Files Coverage Δ
...postcss-merge-rules/src/lib/ensureCompatibility.js 100.00% <100.00%> (ø)
packages/postcss-merge-rules/src/index.js 93.67% <0.00%> (-4.03%) ⬇️
packages/postcss-ordered-values/src/index.js 100.00% <0.00%> (ø)
...ages/postcss-ordered-values/src/rules/listStyle.js 94.73% <0.00%> (ø)
packages/cssnano/src/__tests__/_processCss.js 100.00% <0.00%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f326b7f...7c68ce6. Read the comment docs.

'::grammar-error': 'grammar-error',

'::part()': '::part',
'::slotted()': '::slotted',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why some have () parenthesis, some doesn't have? It is bug?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me check

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok these should not have () but these are level 4 CSS Selector except for the visited.

And I think level 4 is not supported by caniuse-lite , so this all will be removed

@anikethsaha
Copy link
Member Author

I think, visited is at selector level 3 ?

@alexander-akait
Copy link
Member

@anikethsaha Yes 👍

@anikethsaha
Copy link
Member Author

there were level 4 CSS selectors in early commits of this PR, I had to remove them as caniuse-lite doesnt support them i guess

@alexander-akait
Copy link
Member

@anikethsaha So we do not merge selector for 4 level?

@anikethsaha
Copy link
Member Author

currently no!

Cause we dont know their browser support so that may lead to wrong minification.
Once caniuse-lite supports that, I will add them.

@alexander-akait
Copy link
Member

We have some of them https://caniuse.com/#search=selector%204

@anikethsaha
Copy link
Member Author

I guess caniuse-lite API doesn't support that.

I couldn't locate the selectors here.

(may be I missed something, let me know)

@anikethsaha
Copy link
Member Author

https://github.com/ben-eb/caniuse-lite/blob/master/data/features/css-not-sel-list.js
https://github.com/ben-eb/caniuse-lite/blob/master/data/features/css-any-link.js

ohh great, I thought they might have packed like level 2,3 are

I will add those which are supported.

':visited': cssSel3,
':any-link': 'css-any-link',
':read-only': 'css-read-only-write',
':read-write': 'css-read-only-write',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can have more pseudo here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I all covered the level 4. let me check if I missed others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create script to generate this stuff from caniuse-api? It is allow to validate we nothing is missed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I am afraid we can missing something, so we need script to generate and validate it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I am thinking is to simply query using the code name like for :react-write , query using react-write. but two issue can come

  • there may be more that one result, and we dont know which is correct
  • there may be no result as the query can be different

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can parse all existing pseudo from css-whatwg?

@alexander-akait
Copy link
Member

:blank
:defined
:first
:fullscreen
:host
:host-context
:invalid
:matches
:any
:left
:link
:required
:right
:scope
:valid
:where

::cue
::cue-region
::grammar-error
::part
::slotted
::spelling-error

::-moz-progress-bar
::-moz-range-progress
::-moz-range-thumb
::-moz-range-track
::-ms-browse
::-ms-check
::-ms-clear
::-ms-expand
::-ms-fill
::-ms-fill-lower
::-ms-fill-upper
::-ms-reveal
::-ms-thumb
::-ms-ticks-after
::-ms-ticks-before
::-ms-tooltip
::-ms-track
::-ms-value
::-webkit-progress-bar
::-webkit-progress-value
::-webkit-slider-runnable-track
::-webkit-slider-thumb

Need to check each

@anikethsaha
Copy link
Member Author

anikethsaha commented Jun 10, 2020

  • 🚧: I will implement this here
  • ⬆️ : same as above
  • 🤔 : dont know the caniuse-lite feature name of the selector, tried searching here, let me know
pseudo selector status
:blank it is level 4, not sure its caniuse-lite feature name
:defined not sure its caniuse-lite feature name
:first ✔️
:fullscreen ⚠️ , experimental, not sure about its caniuse-lite feature name
:host it is level 1, 🤔
:host-context 🤔
:invalid level 4, 🤔
:matches renamed to :is, level 4, 🤔
:any I think you meant :any-link ? I couldn't find :any in the mdn docs, Let me know
:left ✔️
:link ✔️
:required level 4, 🤔
:right ✔️
:scope level 4, 🤔
:valid level 4, 🤔
:where level 4, 🤔
::cue IDK the feature name,
::cue-region 🤔
::grammar-error 🤔
::part 🤔
::slotted 🤔
::spelling-error 🤔

@anikethsaha
Copy link
Member Author

Also, those verdor prefixed selectors will be un-prefixed using the postcss api here.
also, I couldn't find their feature name for caniuse-lite as well.

@ludofischer
Copy link
Collaborator

I think continuing this work could also fix #999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants