<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>232856</bug_id>
          
          <creation_ts>2021-11-08 16:07:17 -0800</creation_ts>
          <short_desc>format detection applies to DOMParser and interferes with transformations of documents on iOS</short_desc>
          <delta_ts>2022-08-10 04:33:27 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari 15</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 15</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Derk-Jan Hartman">hartman.wiki</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bdakin</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>rniwa</cc>
    
    <cc>thorton</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1812905</commentid>
    <comment_count>0</comment_count>
    <who name="Derk-Jan Hartman">hartman.wiki</who>
    <bug_when>2021-11-08 16:07:17 -0800</bug_when>
    <thetext>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 .....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1813995</commentid>
    <comment_count>1</comment_count>
      <attachid>443941</attachid>
    <who name="Derk-Jan Hartman">hartman.wiki</who>
    <bug_when>2021-11-11 05:45:43 -0800</bug_when>
    <thetext>Created attachment 443941
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1813998</commentid>
    <comment_count>2</comment_count>
    <who name="Derk-Jan Hartman">hartman.wiki</who>
    <bug_when>2021-11-11 05:53:33 -0800</bug_when>
    <thetext>Added test case, showing the different behaviour on iOS (red) and macOS (green)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1815267</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-11-15 16:08:54 -0800</bug_when>
    <thetext>&lt;rdar://problem/85433241&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1890257</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-10 04:33:15 -0700</bug_when>
    <thetext>I am able to reproduce this bug in iPhone 13 Pro Max using iOS 15.6 and it shows &quot;Red&quot; compared to &quot;Green&quot; on Safari 15.6 on macOS 12.5. Just wanted to share updated results. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>443941</attachid>
            <date>2021-11-11 05:45:43 -0800</date>
            <delta_ts>2021-11-11 05:45:43 -0800</delta_ts>
            <desc>testcase</desc>
            <filename>domparser_format_detection.html</filename>
            <type>text/html</type>
            <size>1093</size>
            <attacher name="Derk-Jan Hartman">hartman.wiki</attacher>
            
              <data encoding="base64">PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBuYW1lID0gImZvcm1hdC1kZXRlY3Rpb24iIGNvbnRl
bnQgPSAidGVsZXBob25lPW5vIj4KICAgIDxzdHlsZT4KICAgICAgYm9keS5wYXNzZWQgewogICAg
ICAgIGJhY2tncm91bmQ6Z3JlZW47CiAgICAgIH0KICAgICAgYm9keS5mYWlsZWQgewogICAgICAg
IGJhY2tncm91bmQ6cmVkOwogICAgICB9CiAgICA8L3N0eWxlPgogIDwvaGVhZD4KICA8Ym9keT4K
ICAgICAgPHA+VGVzdGNhc2Ugb2YgZm9ybWF0IGRldGVjdGlvbiBhcHBseWluZyBET01QYXJzZXIu
cGFyc2VGcm9tU3RyaW5nKCkgdG8gZXZlbiBpZiB0aGUgcGFyZW50IGRvY3VtZW50IGhhcyBpdCBk
aXNhYmxlZDwvcD4KICAgIDxwPgogICAgICBUaGUgZm9sbG93aW5nIGZyYWdtZW50IHdhcyBwYXJz
ZWQgc2VwYXJhdGVseSBhbmQgYWRkZWQgdG8gdGhpcyBkb2N1bWVudCBhcyB2aXN1YWwgY2hlY2s6
CiAgICA8L3A+CiAgICA8c2NyaXB0PgogICAgZnVuY3Rpb24gdGVzdCAoKSB7CiAgICAgIGNvbnN0
IG5ld0h0bWwgPSBgCiAgICAgIDxodG1sPgogICAgICAgIDxib2R5PgogICAgICAgIDxwPkNhbGwg
dXMgbm93OiA1NTUtMTIzNDwvcD4KICAgICAgICA8L2JvZHk+CiAgICAgIDwvaHRtbD5gCiAgICAg
IGNvbnN0IGRvbVBhcnNlciA9IG5ldyBET01QYXJzZXIoKTsKICAgICAgY29uc3QgbmV3RG9jdW1l
bnQgPSBkb21QYXJzZXIucGFyc2VGcm9tU3RyaW5nKG5ld0h0bWwsICd0ZXh0L2h0bWwnKQogICAg
ICBjb25zdCBsaW5rcyA9IG5ld0RvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoJ2FbaHJlZl49InRl
bDoiXScpCiAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoIG5ld0RvY3VtZW50LmJvZHku
Y2hpbGRyZW5bMF0gKTsKICAgICAgaWYgKGxpbmtzLmxlbmd0aCA+IDApIHsKICAgICAgICBkb2N1
bWVudC5ib2R5LmNsYXNzTmFtZSA9ICdmYWlsZWQnOwogICAgICAgIGNvbnNvbGUuZXJyb3IoJ2Zh
aWxlZCcpOwogICAgICAgIHJldHVybjsKICAgICAgfQogICAgICBkb2N1bWVudC5ib2R5LmNsYXNz
TmFtZSA9ICdwYXNzZWQnOwogICAgfQoKICAgIHRlc3QoKTsKICAgIDwvc2NyaXB0PgogIDwvYm9k
eT4KPC9odG1sPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>