`oncancel` is undefined on `<dialog>` elements
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox117 | --- | verified |
People
(Reporter: rchristian, Assigned: vhilla)
References
Details
(Keywords: good-first-bug)
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0
Steps to reproduce:
Example HTML Doc:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<dialog id="dialog">
<h1>Example Text</h1>
</dialog>
<button id="dialog-button">Show Dialog</button>
</div>
<script>
const dialog = document.getElementById('dialog');
const showDialogButton = document.getElementById('dialog-button');
showDialogButton.addEventListener('click', () => dialog.showModal());
dialog.addEventListener('cancel', () => console.log('cancel event'));
dialog.addEventListener('close', () => console.log('close event'));
console.log(`Dialog "oncancel" is: ${dialog.oncancel}`);
</script>
</body>
</html>
Actual results:
While the cancel event works as intended, oncancel is undefined, rather than null. This creates an issue in some UI frameworks that only attach the event when it can be found in the DOM.
Expected results:
oncancel should be null.
A friend did find the attached image in Firefox's source, which seems a bit odd. Something that fell through the gaps when implementing, perhaps?
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 2•2 years ago
|
||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
| bugherder | ||
Updated•2 years ago
|
Comment 7•2 years ago
|
||
Reproduced the issue with Firefox 115.0a1 (2023-05-19) on Windows 10x64. Opening the HTML page from comment 0 will show Dialog "oncancel" is: undefined in the web console.
The issue is verified fixed with Firefox 117.0b6 on Windows 10x64, macOS 12 and Ubuntu 22. Dialog "oncancel" is: null message is displayed inside the web console when opening the HTML page.
Description
•