Closed Bug 157299 Opened 23 years ago Closed 19 years ago

DOMParser's parseFromString limits text nodes to 4096 bytes

Categories

(Core :: XML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 194231

People

(Reporter: dgym, Assigned: hjtoi-bugzilla)

References

()

Details

Attachments

(1 file)

the above link gives the simplest demonstration I could think of (view the source). any text element over 4096 bytes long in an xml string parsed with '(new DOMParser()).parseFromString' is truncated to 4Kbytes in the corresponding text node. e.g. doc = (new DOMParser()).parseFromString( '<a>text...more...than...4096...bytes</a>', 'text/xml' ); doc.documentElement.firstChild.nodeValue.length == 4096;
does this bug still exist in 1.1beta?
QA Contact: petersen → rakeshmishra
Attached file Another testcase
This builds a long string, passes it through DOMParser parseFromString, then prints the length of the string, the length of the resulting dom object, and the text of dom object. The object is being truncated to 4096 characters.
Using Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021207. I can reproduce the behavior described. Both the reporter's testcase and the one I just attached show the text element being truncated to 4096 characters.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This should happen for all XML documents you load, not just for the documents you load using DOMParser; could you please test? Could you also please test if there are more text nodes following the first one? I am pretty sure we break longer than 4kb text blocks to several text nodes in the DOM for perf reasons. If there are, then this is allowed per the DOM Recommendations, I believe.
Indeed, as Heikki Toivonen assumed, the text is being broken down into several text nodes which is perfectly allowable. I have updated my test script to include the length of all the text nodes and everything adds up just fine, so this never was a bug - just a bit unexpected. Thanks for all the help.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Status: REOPENED → RESOLVED
Closed: 23 years ago19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: