<?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>10881</bug_id>
          
          <creation_ts>2006-09-16 00:53:33 -0700</creation_ts>
          <short_desc>Selecting the entire range of an inline element causes the element to be deleted</short_desc>
          <delta_ts>2012-05-01 20:42:38 -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>419.x</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Robert Burns">robburns1</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>55636</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Burns">robburns1</who>
    <bug_when>2006-09-16 00:53:33 -0700</bug_when>
    <thetext>Selecting the entire range of an inline element causes the element to be deleted and replaced by a &lt;span&gt; element with class=&quot;apple-style-span&quot;. The following code reproduces the problem. This is an attempt at a workaround for another bug (to be reported). WebView generally has problems with selectedDOMRange navigation (keyboard and programmatically)  editing problems when working near the bondary of an element.

		if ([selectedRange collapsed]) {
			
			textPlaceholder = [theDOMDocument createTextNode:
				[NSString stringWithFormat:@&quot;%c%c%c&quot;,
					8203, 8203, 8203]];
			textPlaceholder2 = [theDOMDocument createTextNode:
				[NSString stringWithFormat:@&quot;%c&quot;,
					8203]];			
			textPlaceholder3 = [theDOMDocument createTextNode:
				[NSString stringWithFormat:@&quot;%c&quot;,
					8203]];			
			
			
			[newElement appendChild:textPlaceholder];
			
			[selectedRange insertNode:newElement];
			if (debugState == YES) NSLog(@&quot;the selected range is: %@&quot;, selectedRange);

			// if these are set to  0 and 3 (selecting the entire range of newElement the newElement
                       // will be replaced by an apple style span wrapping the entire paragraph set to
                       //  &quot;font-style:normal&quot; and another set to &quot;font-style:bold&quot;
			[selectedRange setStart:textPlaceholder :1];
			[selectedRange setEnd:textPlaceholder :2];

			elementInsertionRange = selectedRange;
			if (debugState == YES) NSLog(@&quot;the selected range is: %@&quot;, selectedRange);
			[webView display];
			
		} else {
			
			aFragment = [selectedRange cloneContents];
			NSLog(@&quot;aFragment is %@&quot;, [aFragment textContent]);
			[newElement appendChild:aFragment];
			// [selectedRange surroundContents:newElement];
			[webView replaceSelectionWithNode:newElement];
		}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>613934</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-05-01 20:42:38 -0700</bug_when>
    <thetext>Could you give us an example? e.g. markup + editing operations to reproduce the bug?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>