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

[Feature Request] "Compatibility Mode" for preset-typography #2051

Closed
BeiyanYunyi opened this issue Jan 7, 2023 · 0 comments · Fixed by #2064
Closed

[Feature Request] "Compatibility Mode" for preset-typography #2051

BeiyanYunyi opened this issue Jan 7, 2023 · 0 comments · Fixed by #2064

Comments

@BeiyanYunyi
Copy link
Contributor

It seems that preset-typography doesn't work well on some traditional browsers because it used the :where() selector, which does not work on Chrome before version 88 and Firefox before version 78 according to the browser compatibility table on MDN. It's partially same for :not() selector too.

Since I'm working on a website whose users use very old browsers, I need a workaround. It seems like that add a option to disable not utility (default to not-prose) is the only solution, because with it disabled, the :where() and :not() selectors are no longer needed.

The main change is below:

if (match) {
const matchStr = match[0]
s = s.replace(matchStr, '')
return `${escapedSelector} :where(${s})${notProseSelector}${matchStr}`
}

// change to
if (match) {
  const matchStr = match[0]
  s = s.replace(matchStr, '')
  if (compatibilityMode) return `${escapedSelector} ${s}${matchStr}`
  return `${escapedSelector} :where(${s})${notProseSelector}${matchStr}`
}

If you think this is a good idea, I can make a pull request.

BeiyanYunyi added a commit to BeiyanYunyi/unocss that referenced this issue Jan 10, 2023
@zyyv zyyv linked a pull request Jan 10, 2023 that will close this issue
ydcjeff added a commit that referenced this issue Jan 20, 2023
Co-authored-by: Chris <1633711653@qq.com>
Co-authored-by: Jeff Yang <n2ya@duck.com>
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

Successfully merging a pull request may close this issue.

1 participant