WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
5728
createDocument should create a document element
https://bugs.webkit.org/show_bug.cgi?id=5728
Summary
createDocument should create a document element
Anders Carlsson
Reported
2005-11-13 11:21:51 PST
Currently, DOMImplementation::createDocument does not create a root document element.
Attachments
Add document element
(12.25 KB, patch)
2005-11-13 11:36 PST
,
Anders Carlsson
eric
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Anders Carlsson
Comment 1
2005-11-13 11:36:40 PST
Created
attachment 4681
[details]
Add document element
Eric Seidel (no email)
Comment 2
2005-11-13 11:42:29 PST
Comment on
attachment 4681
[details]
Add document element Looks good. r=me.
Frederick C. Lee
Comment 3
2008-01-10 16:16:51 PST
Safari 3.0.4: The following code FAILS with the following: TypeError: Value undefined (result of expression xmlDoc.load) is not object.
http://www.w3schools.com/xpath/tryit_view.asp?filename=try_xpath_select_cdnodes
Note: Safari passes the W3C conditional as stated, but *failed* in creating a DOM doc. The code is: <html> <body> <script type="text/javascript"> function loadXMLDoc(fname) { var xmlDoc; // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } xmlDoc.async=false; xmlDoc.load(fname); return(xmlDoc); } xml=loadXMLDoc("books.xml"); path="/bookstore/book/title" // code for IE if (window.ActiveXObject) { var nodes=xml.selectNodes(path); for (i=0;i<nodes.length;i++) { document.write(nodes[i].childNodes[0].nodeValue); document.write("<br />"); } } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { var nodes=document.evaluate(path, xml, null, XPathResult.ANY_TYPE, null); var result=nodes.iterateNext(); while (result) { document.write(result.childNodes[0].nodeValue); document.write("<br />"); result=nodes.iterateNext(); } } </script> </body> </html> --------- You can see for yourself via the following link:
http://www.w3schools.com/xpath/tryit.asp?filename=try_xpath_select_cdnodes
This works with Mozilla & IE; but *NOT* Safari 3.0.4 (Mac/Win).
Alexey Proskuryakov
Comment 4
2008-01-11 02:38:43 PST
Sure, we don't currently support the non-standard Document.load extension. This is a mistake for w3schools.com to recommend it. And most certainly, this has nothing to do with the original bug.
Lucas Forschler
Comment 5
2019-02-06 09:03:44 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.
Top of Page
Format For Printing
XML
Clone This Bug