Skip to content
This repository was archived by the owner on Nov 16, 2024. It is now read-only.

Add Default Options for Color Picker Custom Element Class #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skovy
Copy link

@skovy skovy commented May 29, 2024

We are experiencing an error when the custom element for the Color Picker is being cloned. It's a bit of a long story, but we are using Turbo Drive which calls cloneNode and we cannot easily prevent it. Since this is a custom element, I think it's a reasonable expectation it should support the HTMLElement helpers.

This error can be reproduced in a browser by selecting the xy-color-picker custom element in the respective "Elements" tab. Then going to the JavaScript "Console" and typing $0.cloneNode() where $0 is a reference to that element (Chrome devtools).

image

This errors because cloneNode is constructing the element without any arguments, which this constructor assumes.

This PR addresses this error by defaulting options to {} which avoids options being undefined.

@skovy skovy changed the title Add Default for Color Picker Options Add Default Options for Color Picker Custom Element Class May 29, 2024
@skovy
Copy link
Author

skovy commented May 29, 2024

@flaming-cl let me know if there's anything else I can do to help get this merged and released, thanks!

Copy link

@rohin-stafflink rohin-stafflink left a comment

Choose a reason for hiding this comment

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

LGTMM

@mla-v-office
Copy link

Can it be merged and published?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants