Skip to content

Conversation

@dbajpeyi
Copy link
Collaborator

@dbajpeyi dbajpeyi commented Jul 17, 2025

Reviewer: @GioSensation @muodov
cc: @borgateo
Asana:

Description

Safer access to global customElements via c-s-s.captured-globals.js, in case the variable is redefined or shadowed.

Steps to test

@dbajpeyi dbajpeyi changed the title use safer globalthis.customelements [CustomElements] use safer globalthis.customelements Jul 17, 2025
@dbajpeyi dbajpeyi requested a review from Copilot July 17, 2025 09:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the FormAnalyzer to use a safer approach for accessing the customElements API by referencing it through globalThis.customElements instead of the global customElements variable.

  • Changes direct customElements reference to globalThis.customElements to prevent issues if the global variable is overridden
  • Maintains existing null-safe access pattern with optional chaining

@dbajpeyi dbajpeyi marked this pull request as draft July 17, 2025 09:07
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/global-this-custom-elements branch from 50838ce to d2a33f4 Compare July 17, 2025 09:12
@dbajpeyi dbajpeyi marked this pull request as ready for review July 17, 2025 09:42
@dbajpeyi dbajpeyi changed the title [CustomElements] use safer globalthis.customelements [CustomElements] use safer captured customelements Jul 17, 2025
@dbajpeyi
Copy link
Collaborator Author

Nvm, I will re-visit this to fix the tests.

Copy link
Contributor

@borgateo borgateo left a comment

Choose a reason for hiding this comment

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

LGTM

@borgateo borgateo self-requested a review July 17, 2025 13:11
@borgateo
Copy link
Contributor

@dbajpeyi Let us know when the tests are updated 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants