<?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>275185</bug_id>
          
          <creation_ts>2024-06-05 15:42:09 -0700</creation_ts>
          <short_desc>Selection&apos;s .focusOffset can exceed the number of child nodes that .focusNode has</short_desc>
          <delta_ts>2024-06-12 15:43:13 -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>HTML Editing</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 14</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=251020</see_also>
          <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="Han">laughinghan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>karlcow</cc>
    
    <cc>megan_gardner</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2039970</commentid>
    <comment_count>0</comment_count>
    <who name="Han">laughinghan</who>
    <bug_when>2024-06-05 15:42:09 -0700</bug_when>
    <thetext>In both Safari 17 and the latest Safari Tech Preview, the selection&apos;s .focusOffset can exceed the number of child nodes that .focusNode has, if the cursor is at the top-level of a contentEditable and a child is removed in a `beforeinput` event handler: https://output.jsbin.com/wupuhef

Possibly related? https://bugs.webkit.org/show_bug.cgi?id=251020</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039984</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-06-05 17:10:57 -0700</bug_when>
    <thetext>*** Firefox Nightly 128 ***

focusOffset: 7 focusNode children: 7

focusOffset: 6 focusNode children: 6

focusOffset: 7 focusNode text length: 7

focusOffset: 6 focusNode text length: 6

*** Safari Technology Preview 196 ***

focusOffset: 7 focusNode children: 7

focusOffset: 7 focusNode children: 6 &lt;---- focusOffset

focusOffset: 7 focusNode text length: 7

focusOffset: 6 focusNode text length: 6

*** Chrome Canary 127 ***

focusOffset: 1 focusNode children: 0

focusOffset: 6 focusNode children: 6

focusOffset: 7 focusNode text length: 7

focusOffset: 6 focusNode text length: 6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2041080</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-06-12 15:43:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/129715470&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>