The problem _javascript technique of textnode fragmentation in Firefox

Source: Internet
Author: User
The common behavior of AJAX applications is to back up the data in the background with XML to return to the browser, browser parsing XML, get NodeValue

If the content in a single node is very long (more than 4096 bytes), then it is important to note in Firefox/mozilla that the content will be friefox into multiple textnode, each 4096 bytes in size. This situation can be handled using the following functions (IE compatible)

Copy Code code 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<node.childnodes.length;j++) {
S+=new String (Node.childNodes.item (j). NodeValue);
}
return s;
}else
Return "";
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.