Skip to content

Regression: Unable to change borderWidth when border contains a CSS variable #247

@noahnu

Description

@noahnu

Reproducible test case:

it("should allow changing a single property on a border, when border contains a css variable", () => {
  const style = new CSSStyleDeclaration();
  style.border = "0.1rem solid var(--my-color-value)";
  style.borderWidth = "0.2rem";
  assert.strictEqual(style.borderWidth, "0.2rem");
  assert.strictEqual(style.border, "0.2rem solid var(--my-color-value)");
});

It fails on the style.borderWidth = "0.2rem"; line with:

TypeError [Error]: Cannot create property 'border-width' on string '0.1rem solid var(--my-color-value)'

This doesn't crash in cssstyle@v4.6.0 (though technically the individual property didn't change either, but at least it didn't crash).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions