<?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>28472</bug_id>
          
          <creation_ts>2009-08-19 13:09:43 -0700</creation_ts>
          <short_desc>webkit can not unformat super- and sub-script containing BR</short_desc>
          <delta_ts>2017-07-18 08:29:18 -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</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>NEW</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>1</everconfirmed>
          <reporter name="Philip Tucker">ptucker</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ayg</cc>
    
    <cc>enrica</cc>
    
    <cc>jparent</cc>
    
    <cc>michaelthomas</cc>
    
    <cc>rniwa</cc>
    
    <cc>tony</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>141565</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Tucker">ptucker</who>
    <bug_when>2009-08-19 13:09:43 -0700</bug_when>
    <thetext>The latest version of WebKit (532) fixed a bug where contentEditable could not unformat SUB and SUPER tags. But it still fails when the text contains a BR. e.g.,

For this HTML ...

&lt;div id=&quot;editor&quot; contenteditable=true&gt;super&lt;sup&gt;script&lt;img&gt;&lt;/sup&gt;&lt;/div&gt;

... if I select &quot;script&quot; and execCommand(&quot;superscript&quot;), it works correctly, it simply removes the super tags. But if I change the HTML to this ...

&lt;div id=&quot;editor&quot; contenteditable=true&gt;super&lt;sup&gt;script&lt;br&gt;&lt;/sup&gt;&lt;/div&gt;

... &quot;script&quot; stays superscripted, and the underlying HTML becomes this ugliness ...

&lt;div id=&quot;editor&quot; contenteditable=true&gt;super&lt;sup&gt;&lt;span class=Apple-style-span style=&quot;vertical-align: baseline;&quot;&gt;script&lt;/span&gt;&lt;br&gt;&lt;/sup&gt;&lt;/div&gt;

Example:

http://www.plexode.com/cgi-bin/eval3.py#ht=%3Cdiv%20id%3D%22editor%22%20contenteditable%3Dtrue%3Esuper%3Csup%3Escript%3Cbr%3E%3C%2Fsup%3E%3C%2Fdiv%3E%0A&amp;ohh=1&amp;ohj=1&amp;jt=var%20div%20%3D%20document.getElementById(&apos;editor&apos;)%3B%0A%0A%2F%2F%20Change%20this%20to%20select%20a%20range%0AselectRange(div%2C%201%2C%20div%2C%202)%3B%0A%0A%2F%2F%20Change%20this%20to%20run%20execCommand%0Adocument.execCommand(&apos;superscript&apos;%2C%20false%2C%20null)%3B%0A%0Afunction%20selectRange(startNode%2C%20startOffset%2C%20endNode%2C%20endOffset)%20%7B%0A%20%20var%20sel%20%3D%20window.getSelection()%3B%0A%20%20var%20range%20%3D%20null%3B%0A%20%20try%20%7B%0A%20%20%20%20range%20%3D%20sel.getRangeAt(0)%3B%0A%20%20%7D%20catch(ex)%20%7B%0A%20%20%20%20range%20%3D%20document.createRange()%3B%0A%20%20%7D%0A%20%20range.setStart(startNode%2C%20startOffset)%3B%0A%20%20range.setEnd(endNode%2C%20endOffset)%3B%0A%20%20sel.removeAllRanges()%3B%0A%20%20sel.addRange(range)%3B%0A%7D&amp;ojh=1&amp;ojj=1&amp;ms=100&amp;oth=0&amp;otj=0&amp;cex=1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>454010</commentid>
    <comment_count>1</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-08-19 13:11:00 -0700</bug_when>
    <thetext>Cannot reproduce in Chrome 15.0.849.0 dev.  It works as expected for me.  Actually, it goes a bit further and removes the &lt;sup&gt; entirely, not even leaving the part around the unselected &lt;br&gt;, but I guess that&apos;s due to selection normalization.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>