Skip to content

Commit

Permalink
Allow arbitrary whitespaces in supports queries (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Jan 26, 2024
1 parent 888260c commit 525d787
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -893,7 +893,7 @@ var QUERIES = {
},
supports: {
matches: ['supportType', 'feature'],
regexp: /^(?:(fully|partially) )?supports\s+([\w-]+)$/,
regexp: /^(?:(fully|partially)\s+)?supports\s+([\w-]+)$/,
select: function (context, node) {
env.loadFeature(browserslist.cache, node.feature)
var withPartial = node.supportType !== 'fully'
Expand Down
11 changes: 11 additions & 0 deletions test/feature.test.js
Expand Up @@ -72,6 +72,12 @@ test('selects browsers by feature, including partial support', () => {
'chrome 82',
'chrome 81'
])

equal(browserslist('partially supports rtcpeerconnection'), [
'and_chr 81',
'chrome 82',
'chrome 81'
])
})

test('selects browsers by feature, omiting partial support', () => {
Expand All @@ -85,6 +91,11 @@ test('selects browsers by feature, omiting partial support', () => {
'and_chr 81',
'chrome 82'
])

equal(browserslist('fully supports rtcpeerconnection'), [
'and_chr 81',
'chrome 82'
])
})

test('selects browsers by feature with dashes in its name', () => {
Expand Down

0 comments on commit 525d787

Please sign in to comment.