Bug 151969

Summary: SVGDocument getElementById returns null when svg element is disconnected from documents
Product: WebKit Reporter: Jérémy Lal <kapouer>
Component: SVGAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, mmaxfield, rniwa, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Linux   
Attachments:
Description Flags
Example none

Jérémy Lal
Reported 2015-12-07 15:45:32 PST
When testing this snippet with chromium 47 / firefox 38, both logged statements are true. However with epiphany 3.18 / webkitgtk 2.10.4 second statement is false. <!DOCTYPE html> <html> <body> <svg xmlns="http://www.w3.org/2000/svg"> <g id="test"></g> </svg> <script type="text/javascript"> var svg = document.querySelector('svg'); console.log("is root#test found when root is in document ?", svg.getElementById('test') != null); svg.remove(); console.log("is root#test found when root is not in document ?", svg.getElementById('test') != null); </script> </body> </html>
Attachments
Example (410 bytes, text/html)
2016-10-12 06:37 PDT, Dirk Schulze
no flags
Dirk Schulze
Comment 1 2016-10-12 06:37:21 PDT
Ahmad Saleem
Comment 2 2022-07-14 09:43:09 PDT
I am able to reproduce this bug in Safari 15.5 on macOS 12.4 using attached "Example" test case and the output across all browsers are as follow: *** Safari 15.5 on macOS 12.4 *** is root#test found when root is in document ? – true is root#test found when root is not in document ? – false *** Firefox Nightly 104 *** is root#test found when root is in document ? – true is root#test found when root is not in document ? – true *** Chrome Canary 105 *** is root#test found when root is in document ? – true is root#test found when root is not in document ? – true
Ryosuke Niwa
Comment 4 2022-07-14 14:40:57 PDT
EWS
Comment 5 2022-07-14 16:19:26 PDT
Committed 252478@main (71e97d661b45): <https://commits.webkit.org/252478@main> Reviewed commits have been landed. Closing PR #2427 and removing active labels.
Radar WebKit Bug Importer
Comment 6 2022-07-14 16:20:20 PDT
Note You need to log in before you can comment on or make changes to this bug.