Bug 11823 - XSLTProcessor.transformToFragment inserts extra whitespace node at start of resulting fragment
Summary: XSLTProcessor.transformToFragment inserts extra whitespace node at start of r...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-13 18:56 PST by Johnvey Hwang
Modified: 2007-10-05 05:51 PDT (History)
1 user (show)

See Also:


Attachments
test case (works correctly) (1.13 KB, text/html)
2007-07-02 04:30 PDT, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johnvey Hwang 2006-12-13 18:56:38 PST
The output from the transformToFragment() method inserts a leading whitespace node (nodeType=3) at the beginning of the returned fragment.

Ex:

// obtain an XML doc
var inputXml = '<somexml />';

// setup a receiving node
var container = document.createElement('div');

// do the transform
var transformedFragment = XSLTProcessor.transformToFragment(inputXml, document);

// insert the fragment into the DOM
container.appendChild(transformedFragment);

// verify that XML has no leading whitespace node
var x = (inputXml.firstChild.nodeType == 1)  // returns true

// check the inserted fragment
var y = (container.firstChild.nodeType == 1) // returns false

The nodeType of container.firstChild is 3 (a whitespace).  The expected behavior (as is from Firefox and IE) is not to have an extra whitespace node.
Comment 1 Alexey Proskuryakov 2007-07-02 04:30:35 PDT
Created attachment 15348 [details]
test case (works correctly) 

I have tried to create a test case from this bug description, but couldn't - transformToFragment worked correctly for me.

Obviously, this may depend on the stylesheet used. Could you please attach a complete test case?
Comment 2 Alexey Proskuryakov 2007-10-05 05:51:08 PDT
No reply to a request for additional information in three months; closing.