Bug 10239

Summary: XMLSerializer drops attribute values when attribute are previously accessed with getAttributeNode
Product: WebKit Reporter: Cedric Savarese <cedric>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: ap, cdumez
Priority: P2    
Version: 417.x   
Hardware: Mac   
OS: OS X 10.4   
URL: http://www.veerwest.com/test/safari_test_case.html

Cedric Savarese
Reported 2006-08-03 13:08:37 PDT
See the test case provided. Here is the javascript code that reproduces the problem. <script type="text/javascript"> var domDoc = (new DOMParser()).parseFromString("<test><element attr1=\"test\" attr2=\"\" attr3=\"something\" /></test>", "text/xml"); var xmlSerializer = new XMLSerializer(); var serializedXML = xmlSerializer.serializeToString(domDoc); document.write("<textarea cols='60' rows='5'>" + serializedXML + "</textarea>"); var element = domDoc.getElementsByTagName('element')[0]; attr = element.getAttributeNode('attr1'); var serializedXML = xmlSerializer.serializeToString(domDoc); document.write("<textarea cols='60' rows='5'>" + serializedXML + "</textarea>"); document.write("<br/>Node value: "+ element.getAttributeNode('attr1').nodeValue); </script> The second textarea shows that the value for the attr1 attribute is lost in the serialization. The DOM is still correct because the value can still be accessed. If the call to getAttributeNode is removed, the second serialization works fine.
Attachments
Alexey Proskuryakov
Comment 1 2006-08-04 06:07:23 PDT
I can reproduce this issue with stock 10.4.7 Safari, but not with a recent nightly (r15780). You can get a nightly build to verify the behavior from <http://nightly.webkit.org>. Not sure what exactly fixed this, so closing as WORKSFORME.
Lucas Forschler
Comment 2 2019-02-06 09:02:40 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note You need to log in before you can comment on or make changes to this bug.