<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>17241</bug_id>
          
          <creation_ts>2012-05-30 05:02:42 +0000</creation_ts>
          <short_desc>Editing API spec needs to be aware of PRE contents</short_desc>
          <delta_ts>2013-02-04 02:14:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - HTML Editing APIs</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Aryeh Gregor">ayg</assigned_to>
          <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact name="HTML Editing APIs spec bugbot">sideshowbarker+html-editing-api</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68295</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-05-30 05:02:42 +0000</bug_when>
    <thetext>It appears that the current specification doesn&apos;t do anything special for PRE elements. It needs to be fully aware of PRE elements, and treat each line in PRE as a separate paragraph.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68395</commentid>
    <comment_count>1</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-05-31 11:32:46 +0000</bug_when>
    <thetext>Can you give some examples of what should behave differently?  It is aware of CSS &apos;white-space&apos; values, and in some places treats &apos;pre&apos;/&apos;pre-wrap&apos;/etc. differently (at least for whitespace handling).  insertParagraph also treats address/listing/pre differently from other block elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68436</commentid>
    <comment_count>2</comment_count>
      <attachid>1139</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-05-31 16:52:19 +0000</bug_when>
    <thetext>Created attachment 1139
demo

(In reply to comment #1)
&gt; Can you give some examples of what should behave differently?  It is aware of
&gt; CSS &apos;white-space&apos; values, and in some places treats &apos;pre&apos;/&apos;pre-wrap&apos;/etc.
&gt; differently (at least for whitespace handling).  insertParagraph also treats
&gt; address/listing/pre differently from other block elements.

Sure. As you point out, white-space: pre, white-space: pre-wrap, etc... should be treated like pre here but, indent command for example should treat each line in pre so if we executed indent command with the following selection:

&lt;pre&gt;
[hello]
world
&lt;/pre&gt;

We should get

&lt;blockquote style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;
&lt;pre&gt;hello&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre&gt;world&lt;/pre&gt;

or
&lt;pre&gt;
&lt;blockquote style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;
hello
&lt;/blockquote&gt;
world
&lt;/pre&gt;

Gecko appears to indent the whole block (hello &amp; world) but that doesn&apos;t seem right from user&apos;s perspective because there&apos;s no visual difference between the above markup and

&lt;span style=&quot;white-space: pre&quot;&gt;hello&lt;br&gt;
world&lt;/span&gt;

with which Gecko gladly indents &quot;hello&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68495</commentid>
    <comment_count>3</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-06-01 11:19:26 +0000</bug_when>
    <thetext>Good point.  I was actually thinking about whether we want that behavior for &lt;br&gt;, though.  If I use Shift-Enter to get &quot;&lt;p&gt;foo&lt;br&gt;bar&lt;/p&gt;&quot;, should that really be treated as two blocks instead of one?  It is in browsers, but I&apos;m not sure that makes sense.  &quot;&lt;li&gt;foo&lt;br&gt;bar&lt;/li&gt;&quot; is treated as one block, but &quot;&lt;p&gt;foo&lt;br&gt;bar&lt;/p&gt;&quot; is not . . .

I don&apos;t disagree, though.  As long as we have this behavior for &lt;br&gt;, we should have it for &lt;pre&gt;.  However, the spec and Gecko currently don&apos;t actually produce literal linebreaks in &lt;pre&gt;: hitting Enter inside &lt;pre&gt; generates &lt;br&gt;.  And WebKit splits it into multiple &lt;pre&gt;s, like &lt;p&gt; or &lt;div&gt;.  So the only way you&apos;d get literal \n in &lt;pre&gt; is if the preexisting HTML had it, right?  This strikes me as a low-priority use-case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68525</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-06-01 18:11:17 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Good point.  I was actually thinking about whether we want that behavior for
&gt; &lt;br&gt;, though.  If I use Shift-Enter to get &quot;&lt;p&gt;foo&lt;br&gt;bar&lt;/p&gt;&quot;, should that
&gt; really be treated as two blocks instead of one?

I think it should be. As far as naive users are concerned, &quot;p&quot; is a &quot;br&quot; with extra margins.

&gt; It is in browsers, but I&apos;m not
&gt; sure that makes sense.  &quot;&lt;li&gt;foo&lt;br&gt;bar&lt;/li&gt;&quot; is treated as one block, but
&gt; &quot;&lt;p&gt;foo&lt;br&gt;bar&lt;/p&gt;&quot; is not . . .

In the case of a list item, there is a bullet point (with default css), so it probably makes senes to treat each bullet pointed item as a single entity.

&gt; I don&apos;t disagree, though.  As long as we have this behavior for &lt;br&gt;, we should
&gt; have it for &lt;pre&gt;.  However, the spec and Gecko currently don&apos;t actually
&gt; produce literal linebreaks in &lt;pre&gt;: hitting Enter inside &lt;pre&gt; generates &lt;br&gt;.
&gt;  And WebKit splits it into multiple &lt;pre&gt;s, like &lt;p&gt; or &lt;div&gt;.  So the only way
&gt; you&apos;d get literal \n in &lt;pre&gt; is if the preexisting HTML had it, right?  This
&gt; strikes me as a low-priority use-case.

I think I would be fine if you just inserted &lt;br&gt; at wherever \n appears as some sort of a pre-processing step. Once you support treating-br-as-paragraph-separator (misnomer but can&apos;t think of a better phrase), then it should just work regardless of whether we&apos;re in pre or not.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1139</attachid>
            <date>2012-05-31 16:52:19 +0000</date>
            <delta_ts>2012-05-31 16:52:19 +0000</delta_ts>
            <desc>demo</desc>
            <filename>indent.html</filename>
            <type>text/html</type>
            <size>271</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFPgo8aHRtbD4KPGRpdiBjb250ZW50ZWRpdGFibGU+CjxwcmU+aGVsbG8Kd29ybGQ8
L3ByZT4KPC9kaXY+CjxzY3JpcHQ+Cgp2YXIgcHJlID0gZG9jdW1lbnQucXVlcnlTZWxlY3Rvcign
cHJlJyk7CmdldFNlbGVjdGlvbigpLmNvbGxhcHNlKHByZS5maXJzdENoaWxkLCAwKTsKZ2V0U2Vs
ZWN0aW9uKCkuZXh0ZW5kKHByZS5maXJzdENoaWxkLCA1KTsKZG9jdW1lbnQuZXhlY0NvbW1hbmQo
J2luZGVudCcsIGZhbHNlLCBudWxsKTsKCjwvc2NyaXB0Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>