add_css override should support var replacement for variables declared within the same file

Created on 11 February 2025, about 2 months ago

Overview

ajax.command.customizations.js has an override to the add_css AJAX command that makes it possible to scope styles inside a dialog. This includes functionality to address a limitation of JavaScript's CSSStyleSheet , which has difficulty parsing CSS variables in shorthand declarations when the same style includes a longhand declaration. This logic expects CSS variables to be declared in a previously loaded file, but sometimes (especially with aggregation) , this can happen in the same file.

Proposed resolution

Checking for a CSS variable value is currently done by checking window.getComputedStyle(document.documentElement
This should additionally check for variables declared earlier within the same file. We're already traversing through a csstree that has this information, so writing that to an object to keep track of varnames/values should hopefully be straightforward to do.

User interface changes

πŸ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024