innerHTML doesn't work correctly with xhtml in Chrome

Posted by Desperadeus on Stack Overflow See other posts from Stack Overflow or by Desperadeus
Published on 2010-06-15T17:20:11Z Indexed on 2010/06/15 17:22 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

Hi! I've got a trouble with Chrome5.0.375.70, but FF 3.6.3 and Opera 10.53 are OK. Below is the line of code:

document.getElementById('content').innerHTML = data.documentElement.innerHTML; 

The data object from the code is a document (typeof(data) == 'object') and I've got it by ajax request to chapter01.xhtml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html [
<!ENTITY D "&#x2014;">
<!ENTITY o "&#x2018;">
<!ENTITY c "&#x2019;">
<!ENTITY O "&#x201C;">
<!ENTITY C "&#x201D;">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Alice's Adventures in Wonderland by Lewis Carroll. Chapter I: Down the Rabbit-Hole</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link rel="stylesheet" type="application/vnd.adobe-page-template+xml" href="page-template.xpgt"/>
</head>
<body>
<div class="title_box">
<h2 class="chapnum">Chapter I</h2>
<h2 class="chaptitle">Down the Rabbit-Hole</h2>
<hr/>
</div>

The Chrome cuts all before body and as a result link to css in header is missed; user can't see formatted text and images.

How can I fix it or bypass?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX