Closed Bug 559261 Opened 14 years ago Closed 14 years ago

Midas Demo not preserving line breaks and indentation in HTML Source view

Categories

(www.mozilla.org :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: BijuMailList, Assigned: BijuMailList)

Details

Attachments

(2 files)

Attached file MidasDemo.html
In "View HTML Source" mode if you enter new lines and spaces,
it wont be preserved when next time you come to source view.
new lines are gone an spaces for indentation will be replaced with  

Steps:-
1. go to http://www.mozilla.org/editor/midasdemo/index.html
2. click to check "View HTML Source"
3. Enter following HTML 

<ol>
  <li>level 1</li>
  <ol>
    <li>level 1.1</li>
    <ol>
      <li>level 1.1.1</li>
      <li>level 1.1.2</li>
    </ol>
    <li>level 1.2</li>
  </ol>
  <li>level 2</li>
  <li>level 3</li>
</ol>


4. click to uncheck "View HTML Source"
5. click again to check "View HTML Source"

result:-
you lost all formatting, ie new lines and indentations 


This can be fixed by code change in function "viewsource(source)"
See attached MidasDemo.html
Component: www.mozilla.com → www.mozilla.org
QA Contact: www-mozilla-com → www-mozilla-org
Is this a regression?  If so, from when?
Summary: Midas Demo not preserving line brakes and indentation in HTML Source view → Midas Demo not preserving line breaks and indentation in HTML Source view
Probably a duplicate from bug 596455
Actually, loosing new lines might be related to bug 596455 but I do not see how indentation could be related...
(In reply to comment #2)
> Probably a duplicate from bug 596455

From you test case at bug 596455, this is not dupe

Here the problem is

  var divnode = document.createElement('div');
  var htmlrange = document.body.ownerDocument.createRange();
  divnode.innerHTML = "aaaa<br>bbbb<br>cccc";
  htmlrange.selectNodeContents(divnode);
  alert(htmlrange.toString()); 

gives "aaaabbbbcccc"

Per bz (bug 596455 Comment 13) it is right behaviour.
And issue with indentation is because of non-preformatted text collapse space while displaying.  

(In reply to comment #1)
> Is this a regression?  If so, from when?

I see same issue at google doc in Edit HTML View, since its introduction till the feature removed. 

test in 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) 
Gecko/20081106 SeaMonkey/2.0a2pre
I see same problem

So I dont think it is a regression just that nobody have tested that way I think.
I think this is INVALID then, right?
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
I would prefer to mark it fixed by bug 596455.
Biju, it could be nice if you can confirm that is fixed with the latest nightly.
Resolution: INVALID → FIXED
retested on 
Mozilla/5.0 (Windows NT 6.0; rv:2.0b7pre) 
Gecko/20100921 Firefox/4.0b7pre

bug 559261 FAIL
bug 596455 PASS

(In reply to comment #5)
> I think this is INVALID then, right?

NO....

This bug is against  
   Product:  Websites
   Component: www.mozilla.org

I have already submitted FIX for this issue, ie attachment 438938 [details]
I dont know how/(not have resource) to make patch

Can you assign to somebody who have time to do so...
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
OS: Windows Vista → All
Hardware: x86 → All
Oh, it wasn't clear. This bug has nothing to do with bug 596455 and that's not a regression.

Pascal, do you know who should be pinged for this bug (it's a mozilla.org page)?
The pages in the Editor section are owned by Ehsan now, I believe.
Attachment #438938 - Attachment mime type: text/html → text/plain
Attachment #438938 - Attachment mime type: text/plain → text/html
Attached patch PatchSplinter Review
Attachment #477550 - Flags: review+
Fixed in r74817.

David, do you know how can I update the code on mozilla.org with this revision?
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Changes to trunk go straight to the live site after 10 minutes or so, so you should be all set with that commit.
Indeed they're already live on mozilla.org.

Thanks a lot, Biju, for the patch!
Assignee: nobody → BijuMailList
Status: RESOLVED → VERIFIED
Thanks... Its working...
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: