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:
|
if (name in (node: any)) { |
Which does not check to see if the property is a settable property.
React version: 19.0.0
Steps To Reproduce
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 functionThe expected behavior
React sets attribute as an attribute and does not override function definition
The culprit appears to be this line:
react/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
Line 220 in c56c623
Which does not check to see if the property is a settable property.