Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

add handling for :matches and :is #6145

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions prefixfree.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ for (var keyword in keywords) {

var
selectors = {
':any': ':is',
':any-link': null,
'::backdrop': null,
':fullscreen': null,
Expand Down Expand Up @@ -493,10 +494,12 @@ function supported(selector) {
return !!style.sheet.cssRules.length;
}

var prefixed;
for(var selector in selectors) {
var standard = selectors[selector] || selector
var prefixed = selector.replace(/::?/, function($0) { return $0 + self.prefix })
if(!supported(standard) && supported(prefixed)) {
prefixed = selector.replace(/::?/, function($0) { return $0 + self.prefix });
if((!supported(standard) && !supported(standard + '(a,p)')) &&
(supported(prefixed) || supported(prefixed + '(a,p)') )) {
self.selectors.push(standard);
self.selectorMap[standard] = prefixed;
}
Expand Down