Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

refactor: drop background-clip workarounds (#3234)

Bogdan Chadkinc09f7ea4d703
diff --git a/apps/builder/app/canvas/shared/styles.ts b/apps/builder/app/canvas/shared/styles.ts
index c034007c4f..1133960c6f 100644
--- a/apps/builder/app/canvas/shared/styles.ts
+++ b/apps/builder/app/canvas/shared/styles.ts
@@ -169,11 +169,6 @@ const subscribeEphemeralStyle = (params: Params) => {
continue;
}
- // We don't want to wrap backgroundClip into a var, because it's not supported by CSS variables
- if (property === "backgroundClip") {
- continue;
- }
-
// Variable names are equal, no need to update
if (
propertyValue?.type === "var" &&
@@ -371,16 +366,9 @@ export const useCssRules = ({
deletedProperties.delete(property);
}
- // We don't want to wrap backgroundClip into a var, because it's not supported by CSS variables
- // It's fine because we don't need to update it dynamically via CSS variables during preview changes
- // we renrender it anyway when CSS update happens
- if (property === "backgroundClip") {
- rule.styleMap.set(property, value);
- } else {
- const varValue = toVarValue(styleSourceId, property, value);
- if (varValue) {
- rule.styleMap.set(property, varValue);
- }
+ const varValue = toVarValue(styleSourceId, property, value);
+ if (varValue) {
+ rule.styleMap.set(property, varValue);
}
}
diff --git a/packages/css-engine/src/core/to-property.ts b/packages/css-engine/src/core/to-property.ts
index 76dece9dfd..83650434c7 100644
--- a/packages/css-engine/src/core/to-property.ts
+++ b/packages/css-engine/src/core/to-property.ts
@@ -2,9 +2,9 @@ import hyphenate from "hyphenate-style-name";
import type { StyleProperty } from "../schema";
export const toProperty = (property: StyleProperty) => {
- // Currently its a non-standard property and is only officially supported via -webkit- prefix.
- // Safari illegally supports it without the prefix.
+ // chrome started to support unprefixed background-clip in December 2023
// https://caniuse.com/background-clip-text
+ // @todo stop prerfixed maybe one year later
if (property === "backgroundClip") {
return "-webkit-background-clip";
}