<?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>20654</bug_id>
          
          <creation_ts>2008-09-04 18:14:05 -0700</creation_ts>
          <short_desc>contenteditable iframe changes contents</short_desc>
          <delta_ts>2008-09-08 03:38:36 -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>312.x</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>11947</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Philip Tucker">ptucker</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>ptucker</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>90224</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Tucker">ptucker</who>
    <bug_when>2008-09-04 18:14:05 -0700</bug_when>
    <thetext>We&apos;ve hit another Webkit issue in Google Docs. It seems that Webkit converts &amp;nbsp; to \u00A0 in content-editable mode. I&apos;m guessing it does the same for other entities. This really messes us up with our editor because it looks to us like a user change. Is this a known issue, and is there a workaround?

Sample HTML:

&lt;html&gt;&lt;head&gt;
&lt;script&gt;
var myBody = null;
function init() {
  myBody = document.getElementById(&apos;iframe&apos;).contentWindow.document.body;
  myBody.innerHTML = &quot;hello&amp;nbsp;world&quot;;
  myBody.contentEditable = true;
}
function foo() {
  alert(myBody.innerHTML);
}
&lt;/script&gt;
&lt;/head&gt;&lt;body onload=&quot;init();&quot;&gt;
&lt;iframe id=&quot;iframe&quot; src=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;input type=&quot;button&quot; value=&quot;clickme&quot; onclick=&quot;foo();&quot;&gt;
&lt;/body&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90489</commentid>
    <comment_count>1</comment_count>
      <attachid>23245</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-09-08 03:31:35 -0700</bug_when>
    <thetext>Created attachment 23245
same test as an attachment

Attaching to make testing easier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90490</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-09-08 03:38:36 -0700</bug_when>
    <thetext>This is already fixed in nightlies. Either behavior is correct, but we had to match other browsers on this for compatibility.

I don&apos;t have any workaround to recommend, other than saying that innerHTML is not documented to preserve markup byte to byte, so relying on it is inherently unsafe.

*** This bug has been marked as a duplicate of 11947 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>23245</attachid>
            <date>2008-09-08 03:31:35 -0700</date>
            <delta_ts>2008-09-08 03:31:35 -0700</delta_ts>
            <desc>same test as an attachment</desc>
            <filename>20654.html</filename>
            <type>text/html</type>
            <size>396</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGh0bWw+PGhlYWQ+CjxzY3JpcHQ+CnZhciBteUJvZHkgPSBudWxsOwpmdW5jdGlvbiBpbml0KCkg
ewogIG15Qm9keSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdpZnJhbWUnKS5jb250ZW50V2lu
ZG93LmRvY3VtZW50LmJvZHk7CiAgbXlCb2R5LmlubmVySFRNTCA9ICJoZWxsbyZuYnNwO3dvcmxk
IjsKICBteUJvZHkuY29udGVudEVkaXRhYmxlID0gdHJ1ZTsKfQpmdW5jdGlvbiBmb28oKSB7CiAg
YWxlcnQobXlCb2R5LmlubmVySFRNTCk7Cn0KPC9zY3JpcHQ+CjwvaGVhZD48Ym9keSBvbmxvYWQ9
ImluaXQoKTsiPgo8aWZyYW1lIGlkPSJpZnJhbWUiIHNyYz0iIj48L2lmcmFtZT4KPGlucHV0IHR5
cGU9ImJ1dHRvbiIgdmFsdWU9ImNsaWNrbWUiIG9uY2xpY2s9ImZvbygpOyI+CjwvYm9keT4K
</data>

          </attachment>
      

    </bug>

</bugzilla>