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

Strange behavoiur for prefixing property user-select #925

Open
monochromer opened this issue Mar 4, 2025 · 0 comments
Open

Strange behavoiur for prefixing property user-select #925

monochromer opened this issue Mar 4, 2025 · 0 comments

Comments

@monochromer
Copy link

Sandbox demo: https://stackblitz.com/edit/stackblitz-starters-ssfut1yt?file=lightningcss.js

I have CSS:

pre {
  user-select: all;
}

On this moment, Safari doesn't support user-select without vendor-prefix.

For adding prefixes i use this browserslist config:

last 2 versions
not dead

And code for compiling:

import * as lightningcss from 'lightningcss';
import browserslist from 'browserslist';

const browsers = browserslist();
const targets = lightningcss.browserslistToTargets(browsers);

console.log('browserslist: ', browsers);
console.log('lightningcss: ', targets);

const result = await lightningcss.bundleAsync({
  targets,
  filename: './styles.css',
});

console.log(result.code.toString());

i get unprefixed code:

pre {
  user-select: all;
}

but Safari is in the list:

browserslist:  [
  'and_chr 133',  'and_ff 135',
  'and_qq 14.9',  'and_uc 15.5',
  'android 133',  'chrome 133',
  'chrome 132',   'edge 133',
  'edge 132',     'firefox 135',
  'firefox 134',  'ios_saf 18.3',
  'ios_saf 18.2', 'kaios 3.0-3.1',
  'kaios 2.5',    'op_mini all',
  'op_mob 80',    'opera 114',
  'opera 113',    'safari 18.3',
  'safari 18.2',  'samsung 27',
  'samsung 26'
]

lightningcss:  {
  and_chr: 8716288,
  and_ff: 8847360,
  android: 8716288,
  chrome: 8650752,
  edge: 8650752,
  firefox: 8781824,
  ios_saf: 1180160,
  op_mob: 5242880,
  opera: 7405568,
  safari: 1180160,
  samsung: 1703936
}

LightningCSS Playground have correct prefixed code.

Postcss have another result.

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

No branches or pull requests

1 participant