InnerHTML does not work correctly with xhtml in Chrome

I have problems with Chrome5.0.375.70, but FF 3.6.3 and Opera 10.53 are fine. The following is a line of code:

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

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

<?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 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>

In Chrome, everything is reduced in front of the body and as a result, the link to css in the header is missing ; user cannot see formatted text and images.

How can I fix or work around?

PS I'm trying to put chapter01.xhtml in the div that is contained in<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

+3
2

.innerHTHML . XHTML .

0

, DOM, DOMParser XmlSerializer, :

http://www.hiteshagrawal.com/javascript/convert-xml-document-to-string-in-javascript

.

: html DOMParser DOMDocument, , XmlSerializer IE, .

0

Source: https://habr.com/ru/post/1750159/


All Articles