views:

390

answers:

1

Hi. I'm developing an AJAX site. So the problem is browsers (Safari, Chrome) do not show spaces in AJAX-loaded HTML content after tags like Strong, Em etc.

Then I added a doctype to the AJAX output. Everything was fine, there were all spaces, unless I tested the site in WebKit browsers. When I loaded the page in Safari, I got error:

This page contains the following errors:

error on line 1 at column 7: internal error

Below is a rendering of the page up to the first error.

What do I got to do? Or, in other words, is there any way to output the doctype for WebKit without getting the error?

Output is something like that:

<div class="topic">
    <div class="colon">
     <div class="topictext">
      <h2><a href="/artikul/1" class="showhuman" id="1" onclick="showhumaninfo (1); return false;">KirillTitov</a> tells us:</h2><p>Here you go.<br/>
<b>Bold text</b> <i>italic text</i> <strike>etc</strike>…</p> 
      </div><!-- topictext -->
      <div class="topicright"></div>
      <div class="clear"></div>
      <div class="topicinfo">
      <div class="topicclock">
       <font title="Timestamp for geeks — 1253816398">24&#0160;september,&#0160;year&#0160;2009</font>
      </div><!-- topicclock -->
      <div class="topiccomment">
       <a href="/joindachat/2" class="entertopic" id="2" onclick="entertopic (2); return false;">Go inside</a> (мнений: 0)
      </div><!-- topiccomment -->
     </div><!-- topicinfo -->
     <div class="topicindex">
      <img src="/img/bgtopicindex.gif" border="0" alt="" />
     </div><!-- topicindex -->
     <div class="blur"></div>
    </div><!-- colon -->
    <div class="colon">
     <div class="indextopcomment">
      <div class="commenttopleft"><img src="/img/bgcommentindexgreen.gif" alt="" border="0" /></div>
      <div class="texttopcomment nonenew">
       No comments here.
      </div>
      <div class="clear"></div>
      </div><!-- indextopcomment -->
      </div><!-- colon -->
      <div class="clear"></div>
     </div><!-- topic -->
    <div class="clear"></div>
</div><!-- topic -->
+3  A: 

Have you thought about using &nbsp; in those places?

Also, try the following on your incoming ajax result:

.Replace("\xA0", "&nbsp;").Replace("\x20","&nbsp;");

Some frameworks behave odd in webkit and put not-standard spacing in, is what what you're seeing? Follow-up on if the replace works, if not there are other options, but that's usually the simplest/quickest fix. Here's a full table on the whitespace oddities, but it depends on browser/platform as to which quirk you're hitting normally.

Nick Craver
Thx, the problem was in old version of MooTools. I've just updated MooTools Core and MooTools More and everything got fine :) Here you go, 250 rep.
Kirill Titov
Thanks Kirill, glad you got it working like you wanted
Nick Craver