Closed
Description
React version: 19.0.0
Steps To Reproduce
- Define a custom element as shown:
class CEWithAttrPropertyClash extends HTMLElement {
test(value) {
this.dispatchEvent(new CustomEvent('test', {detail: value}))
}
connectedCallback() {
this.test(true);
}
}
customElements.define('ce-with-attr-property-clash', CEWithAttrPropertyClash);
- Render
render(<ce-with-attr-property-clash test />);
Link to code example: https://codesandbox.io/p/sandbox/green-resonance-kpwcqg?file=%2Fsrc%2FApp.js%3A10%2C1
The current behavior
this.test is not a function
The expected behavior
React sets attribute as an attribute and does not override function definition
The culprit appears to be this line:
Which does not check to see if the property is a settable property.