NEW 232856
format detection applies to DOMParser and interferes with transformations of documents on iOS
https://bugs.webkit.org/show_bug.cgi?id=232856
Summary format detection applies to DOMParser and interferes with transformations of ...
Derk-Jan Hartman
Reported 2021-11-08 16:07:17 PST
https://phabricator.wikimedia.org/T116525 We were trying to figure out why the WYSIWYG/HTML editor for Wikipedia kept adding tel: links in places where we had number/year ranges (like for instance 788-7705), and this was pinpointed to iOS Safari, which supports format-detection https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html#//apple_ref/doc/uid/TP40008193-SW5. After disabling this feature with the meta tag in our main document, the problem still occurred. Further investigation made us discover that not only is format-detection applied to the current/primary document, it is applied to ALL documents including ones generated by DOMParser.parseFromString() which our WYSIWYG/HTML editor relies on. When as a developer you parse the DOM, do transformations etc, you should be able to somewhat accurately predict what DOM is being returned and these links being autogenerated are very unexpected honestly, they are not part of the document that was specified. I know we can adapt all documents we feed the parser, but I highly question these iOS features being applied to more than just the primary document and maybe iframes (and lets be honest they are annoying even there). There also is no way to IDENTIFY these auto generated links from normal links (adding an attribute to identify this as custom iOS generate node seems like an easy/quick win). Alternatively, DOMParser could inherit format-detection settings from the main document, or there could be some sort of flag to toggle this behavior in DOMParser without us having to rewrite the entire html blobstring .....
Attachments
testcase (1.07 KB, text/html)
2021-11-11 05:45 PST, Derk-Jan Hartman
no flags
Derk-Jan Hartman
Comment 1 2021-11-11 05:45:43 PST
Created attachment 443941 [details] testcase
Derk-Jan Hartman
Comment 2 2021-11-11 05:53:33 PST
Added test case, showing the different behaviour on iOS (red) and macOS (green)
Radar WebKit Bug Importer
Comment 3 2021-11-15 16:08:54 PST
Ahmad Saleem
Comment 4 2022-08-10 04:33:15 PDT
I am able to reproduce this bug in iPhone 13 Pro Max using iOS 15.6 and it shows "Red" compared to "Green" on Safari 15.6 on macOS 12.5. Just wanted to share updated results. Thanks!
Note You need to log in before you can comment on or make changes to this bug.