<?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>26443</bug_id>
          
          <creation_ts>2009-06-16 06:57:55 -0700</creation_ts>
          <short_desc>[:first-letter][createlink][contenteditable] Safari creates a link on wrong characters with document.execCommand(&quot;createlink&quot;, false, &quot;somelink&quot;) if the contenteditable element has a :first-letter rule applied to it.</short_desc>
          <delta_ts>2022-06-23 22:08:22 -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>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>6185</dependson>
          <blocked>58911</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dan POPA">dpopa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>enrica</cc>
    
    <cc>rniwa</cc>
    
    <cc>thaddee6yann</cc>
    
    <cc>tkent</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>126196</commentid>
    <comment_count>0</comment_count>
    <who name="Dan POPA">dpopa</who>
    <bug_when>2009-06-16 06:57:55 -0700</bug_when>
    <thetext>Safari crashes on document.execCommand(&quot;createlink&quot;, false, &quot;somelink&quot;) if the contenteditable element has a :first-letter rule applied to it.

Steps to reproduce:
1. have the following in a page:
&lt;style&gt;
.someclass:first-letter {
	font-weight: bold;
}
&lt;/style&gt;
&lt;div class=&quot;someclass&quot; contenteditable=&quot;true&quot;&gt;contentEditable element. Some text and some words.&lt;/div&gt;

&lt;input type=&quot;button&quot; value=&quot;Create link&quot; onclick=&quot;document.execCommand(&apos;createlink&apos;, false, &apos;http://www.google.com&apos;)&quot; /&gt;

2. Select something from the contenteditable DIV.
3. Click the button.

Result: Safari crashes after a few seconds.


A few details, notes on this behavior:

Note 1: Can&apos;t select the first character/letter, see bug #6185

Note 2: Safari doesn&apos;t crash if the selection is inside the first word and it starts before or after the second character in the first word. The selection is shifted one character to the left.
The contenteditable element cannot be focused anymore after createlink if the selection started before the second character, only the link can be focused in this case.

See attachment for testcase.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126197</commentid>
    <comment_count>1</comment_count>
      <attachid>31348</attachid>
    <who name="Dan POPA">dpopa</who>
    <bug_when>2009-06-16 06:59:43 -0700</bug_when>
    <thetext>Created attachment 31348
Testcase showing described behavior</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126198</commentid>
    <comment_count>2</comment_count>
    <who name="Dan POPA">dpopa</who>
    <bug_when>2009-06-16 07:01:22 -0700</bug_when>
    <thetext>Possible related bugs:

bug #22256	Reproduceable crash with @font-face and :first-letter pseudo class
bug #15602	Quirksmode: CSS1: WebKit fails dynamic :first-letter test
bug #14550	Non-layout style change does not update nested first-letter
bug #6185	Bug 6185: CSS1: character styled with :first-letter is not selectable</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126199</commentid>
    <comment_count>3</comment_count>
    <who name="Dan POPA">dpopa</who>
    <bug_when>2009-06-16 07:08:35 -0700</bug_when>
    <thetext>No crash in Safari 3.2.3

But the selection is shifted one character to the left and clicking after the newly created link doesn&apos;t set the selection at the click location (same as in the second note from the bug description)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>175205</commentid>
    <comment_count>4</comment_count>
    <who name="">thaddee6yann</who>
    <bug_when>2009-12-28 02:32:11 -0800</bug_when>
    <thetext>Possibly related issues:

* any text insertion is shifted by a seemingly arbitrary number of characters, usually 1.
* a character entered at the end duplicates the line and sometimes deletes a number of characters at the end of the line.

Note: this is only true on the first line.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>262023</commentid>
    <comment_count>5</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-08-09 01:51:48 -0700</bug_when>
    <thetext>I took a look at the code, and my conclusion is we should close Bug#6185 before this.
(&quot;close&quot; means to fix it or to decide we won&apos;t fix it.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1877963</commentid>
    <comment_count>6</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-06-23 15:58:21 -0700</bug_when>
    <thetext>Based on attached test and following steps from Description, I am not able to crash Safari 15.5 on macOS 12.4. This was fixed long back as commented in Comment 03.

Although - first letter non-selection bug is still present on attached test case (for which we have separate bug - https://bugs.webkit.org/show_bug.cgi?id=6185). Although, Comment 05 mentions that this bug should remain open till some conclusion is reached for the bug).

IMO - We can close this since it is not crashing and leave 6185 open for fixing since now all other browsers have fixed it and first letter is selectable. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1878115</commentid>
    <comment_count>7</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-06-23 22:08:22 -0700</bug_when>
    <thetext>Safari doesn&apos;t hit any crash anymore.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>31348</attachid>
            <date>2009-06-16 06:59:43 -0700</date>
            <delta_ts>2009-06-16 06:59:43 -0700</delta_ts>
            <desc>Testcase showing described behavior</desc>
            <filename>first-letter-createlink-crash.html</filename>
            <type>text/html</type>
            <size>1409</size>
            <attacher name="Dan POPA">dpopa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy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