Skip to content

Commit

Permalink
Fixed checks of pseudo-elements
Browse files Browse the repository at this point in the history
Pseudo-elements containing `-webkit-` as prefix have to be considered valid as parse time for web compatibililty.
So support is now tested using `CSS.supports()` instead of `document.querySelector()`,
  • Loading branch information
SebastianZ committed Aug 10, 2024
1 parent 53bee08 commit b15ab06
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions supports.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,13 @@
for (var i = 0; i < _.prefixes.length; i++) {
var prefixed = selector.replace(/^(:+)/, '$1' + _.prefixes[i]);

try {
document.querySelector(prefixed);
if (CSS.supports('selector(' + prefixed + ')')) {
_.selector.cached[selector] = true;
return {
success: true,
propertyPrefix: _.prefixes[i],
prefix: _.prefixes[i],
};
} catch (e) {}
}
}

_.selector.cached[selector] = false;
Expand Down

0 comments on commit b15ab06

Please sign in to comment.