Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > empty P tags and linebreaks

Reply
Thread Tools

empty P tags and linebreaks

 
 
allie
Guest
Posts: n/a
 
      11-02-2006
I have a problem with inconsistency in IE browser, looking at the
innerHTML property and the actual contents.

I used this in a plain HTML page:

<div contenteditable="true" style="border:solid 1px black"
onblur="alert(this.innerHTML)">
</div>

If you type content with an extra linebreak, and press TAB to leave the
field, you see for example:
<p>a</p>
<p>&nbsp;</p>
<p>b</p>

Note that if you use the cursor to browse the DIV, you do NOT see
actually a space for the second line, there is in fact no space, it is
a empty line.

But if you place exactly this same content inside the editable DIV,
like this:

<div contenteditable="true" style="border:solid 1px black"
onblur="alert(this.innerHTML)">
<p>a</p>
<p>&nbsp;</p>
<p>b</p>
</div>

and then reload your page, then suddenly you DO see the space. How can
this be? How can the innerHTML property be different from the actual
contents ?

Please help me with this ...

 
Reply With Quote
 
 
 
 
Bergamot
Guest
Posts: n/a
 
      11-02-2006
allie wrote:
> I have a problem with inconsistency in IE browser, looking at the
> innerHTML property and the actual contents.


Why don't you go ask in a Microsoft newsgroup?
microsoft.public.<something IE-related>

--
Berg
 
Reply With Quote
 
 
 
 
CRON
Guest
Posts: n/a
 
      11-02-2006
i had the same problem a while back - i fixed it by using php
str_replace to just strip all P tags and replace em with <br/>

 
Reply With Quote
 
allie
Guest
Posts: n/a
 
      11-03-2006
CRON wrote:
> i had the same problem a while back - i fixed it by using php
> str_replace to just strip all P tags and replace em with <br/>


yes, that's what I also did. I am just wondering, is there something
else that you can put inside a <p> tag that is like an empty character,
so that it will be recognized as a line break, not showing anything ?

So not <p>&nbsp;</p> or <p> </p>, because this still shows a space
on the empty paragraph. But is there nothing else?

And bergamot: why is this microsoft related?

 
Reply With Quote
 
Bergamot
Guest
Posts: n/a
 
      11-03-2006
allie wrote:
>
> And bergamot: why is this microsoft related?


Is your query not specific to *Microsoft* Internet Explorer, and a
discrepancy with innerHTML, which happens to be proprietary to MS as well?

It begs the question: Why is this *not* Microsoft related?

--
Berg
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing whitespace and linebreaks in CSS files ahjiang@gmail.com Perl Misc 11 04-12-2006 08:58 PM
linebreaks in a text area meltedown HTML 3 10-20-2005 04:43 AM
email: Content-Disposition and linebreaks with long filenames =?ISO-8859-15?Q?Martin_K=F6rner?= Python 2 04-19-2005 10:16 PM
stringtokenizer that traps ASCII linebreaks wnstnsmith@yahoo.com Java 2 02-11-2004 10:04 PM
Replacing linebreaks with <br> Stefan Landgraf ASP .Net 2 08-19-2003 03:35 PM



Advertisments