browserslist-useragent icon indicating copy to clipboard operation
browserslist-useragent copied to clipboard

Test for caniuse features that contain a key of browserNameMap in their name

Open tndev opened this issue 2 years ago • 0 comments

browserslist has the ability to use supports [feature] to query against caniuse features.

So something like this also works with browserslist-useragent:

matchesUA(
  'Mozilla/5.0 (Windows NT 10.0; rv:54.0) Gecko/20100101 Firefox/54.0',
  { browsers: ['supports es6-module'] }
)

It however fails if the feature to test for contains a key listed in: https://github.com/browserslist/browserslist-useragent/blob/b767e4d53dc712715ca9fe2d0e440b755da652c2/index.ts#L10-L24

Like for example woff or woff2, this is due to https://github.com/browserslist/browserslist-useragent/blob/b767e4d53dc712715ca9fe2d0e440b755da652c2/index.ts#L160-L170

Is there some way to make { browsers: ['supports woff2'] } and working?

tndev avatar Apr 17 '23 19:04 tndev