Home  >  Article  >  Web Front-end  >  Problems with textNode fragmentation in FireFox_javascript skills

Problems with textNode fragmentation in FireFox_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:15:181102browse

A very common behavior in Ajax applications is to wrap the data in XML in the background and return it to the browser. The browser parses the XML and gets nodeValue

. If the content in a single node is very long (more than 4096 bytes), then Please note that in FireFox/Mozilla, the content will be decomposed into multiple textNodes by FrieFox, each with a size of 4096 bytes. This situation can be handled with the following functions (IE compatible)

Copy code The code is as follows:

function getNodeValue(node)
{
if(node ​​&& node.hasChildNodes()){
//return node.firstChild.nodeValue; var s=""
                         /Mozilla has many textnodes with a size of 4096
//chars each instead of one large one.
//They all need to be concatenated. for(var j=0;j                                                                                                                                                                                                                                                                                                    >}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn