Skip to content

Commit

Permalink
Override safari compat data from caniuse for ::marker pseudo element
Browse files Browse the repository at this point in the history
Fixes #508
  • Loading branch information
devongovett committed Jun 12, 2023
1 parent 4ded7a3 commit cff779d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
18 changes: 17 additions & 1 deletion scripts/build-prefixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,34 @@ let cssFeatureMappings = {
'calc': 'CalcFunction'
};

let cssFeatureOverrides = {
// Safari supports the ::marker pseudo element, but only supports styling some properties.
// However this does not break using the selector itself, so ignore for our purposes.
// https://bugs.webkit.org/show_bug.cgi?id=204163
// https://github.com/parcel-bundler/lightningcss/issues/508
'css-marker-pseudo': {
safari: {
'y #1': 'y'
}
}
};

let compat = new Map();
for (let feature of cssFeatures) {
let data = unpack(features[feature]);
let overrides = cssFeatureOverrides[feature];
let browserMap = {};
for (let name in data.stats) {
if (BROWSER_MAPPING[name] === null) {
continue;
}

name = BROWSER_MAPPING[name] || name;
let browserOverrides = overrides?.[name];
for (let version in data.stats[name]) {
if (data.stats[name][version] === 'y') {
let value = data.stats[name][version];
value = browserOverrides?.[value] || value;
if (value === 'y') {
let v = parseVersion(version);
if (v == null) {
console.log('BAD VERSION', feature, name, version);
Expand Down
7 changes: 6 additions & 1 deletion src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,11 @@ impl Feature {
return false;
}
}
if let Some(version) = browsers.safari {
if version < 721152 {
return false;
}
}
if let Some(version) = browsers.opera {
if version < 4718592 {
return false;
Expand All @@ -961,7 +966,7 @@ impl Feature {
return false;
}
}
if browsers.ie.is_some() || browsers.safari.is_some() {
if browsers.ie.is_some() {
return false;
}
}
Expand Down

0 comments on commit cff779d

Please sign in to comment.