Skip to content

Enhance CSSStyleDeclaration constructor options#316

Open
asamuzaK wants to merge 3 commits intojsdom:mainfrom
asamuzaK:constructor
Open

Enhance CSSStyleDeclaration constructor options#316
asamuzaK wants to merge 3 commits intojsdom:mainfrom
asamuzaK:constructor

Conversation

@asamuzaK
Copy link
Contributor

@asamuzaK asamuzaK commented Feb 28, 2026

  • The CSSStyleDeclaration constructor has been modified to suit jsdom.
    Accepting a globalObject as the first argument, args as the second, and private options such as computed, fontSizeMedium, onChangeCallback, and systemColors as the third, and initializing the relevant internal fields.
  • Simplify context handling to set ownerNode for element contexts and parentRule for CSSRule contexts (removed getComputedStyle-based detection and window-lookup via parentStyleSheet).
  • Add placeholder for computed style options.
  • Small punctuation cleanups.

@asamuzaK asamuzaK marked this pull request as draft February 28, 2026 13:35
@asamuzaK
Copy link
Contributor Author

This would probably be a breaking change since it changes how if (context) {} is handled.
If so, should we switch to constructor(globalObject, args, privateData) at this point?

@asamuzaK
Copy link
Contributor Author

asamuzaK commented Mar 1, 2026

This would probably be a breaking change since it changes how if (context) {} is handled. If so, should we switch to constructor(globalObject, args, privateData) at this point?

Done above.

@asamuzaK asamuzaK force-pushed the constructor branch 2 times, most recently from f7f30f2 to 4577cd4 Compare March 1, 2026 00:15
@asamuzaK asamuzaK marked this pull request as ready for review March 1, 2026 01:01
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nit


// TODO: Add private method to prepare options.
// Options for computed style.
this._computedStyleOpts = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this for now, at least until something is actually using it?

Removed TODO comment for private method to prepare options.
@asamuzaK asamuzaK requested a review from domenic March 2, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants