Bug 165248
| Summary: | paste event not triggered when using html + svg elements | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Nicu Micleușanu <micnic90> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | ahmad.saleem792, cdumez, enrica, wenson_hsieh |
| Priority: | P2 | ||
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Nicu Micleușanu
It is impossible to trigger paste in this case:
```
var div = document.createElement('div');
var svg = document.createElementNS("http://www.w3.org/2000/svg","svg");
div.appendChild(svg);
div.tabIndex = -1;
div.style.backgroundColor = '#EEEEFF';
div.style.height = '200px';
div.addEventListener('paste', function(event) { // This event listener is not triggered
console.log('paste: ', event.clipboardData.getData('text'));
});
document.body.appendChild(div);
```
This happens when there is a html element with a svg child element or when there is a html element with a svg child element + a html child element without any content (if it has content it works fine).
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Nicu Micleușanu
For testing: https://jsfiddle.net/etmo8rL5/
Chris Dumez
(In reply to comment #1)
> For testing: https://jsfiddle.net/etmo8rL5/
Test case seems to work in Firefox but fails in Chrome.
Ahmad Saleem
This is reproducible in Safari 17.2.1 and Chrome Canary 122. While it works fine in Firefox Nightly 123 where console logs:
> "paste: ", "https://jsfiddle.net/etmo8rL5/"
Just wanted to share up-to-date results. Should we add it to 'Radar'?