Skip to content

Add support for CSSStyleDeclaration.setProperty() and CSSStyleDeclaration.removeProperty() #113

@MadLittleMods

Description

@MadLittleMods

Add support for CSSStyleDeclaration.setProperty(), CSSStyleDeclaration.removeProperty(), and CSSStyleDeclaration.getPropertyValue().

These are essentially aliases for the getters and setters already present on esm/interface/css-style-declaration.js#L31-L61.

  • HTMLElement.style.setProperty('background-color', 'red'); -> HTMLElement.style.backgroundColor = 'red'; (existing setter)
  • HTMLElement.style.removeProperty('background-color') -> HTMLElement.style.backgroundColor = null; (existing setter)
  • HTMLElement.style.getPropertyValue('background-color') -> HTMLElement.style.backgroundColor (existing getter)

Support for these functions was also mentioned in #92 (comment) where there is some consideration from @WebReflection about whether linkedom should support it.


For reference: I am using linkedom to server-side render (SSR) https://github.com/vector-im/hydrogen-web which uses setProperty, removeProperty, and getPropertyValue in a few places. SSR project is at: https://github.com/matrix-org/matrix-public-archive and linkedom usage is in server/render-hydrogen-to-string.js.

Relevant code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions