Subj : Re: E4X in Rhino expandos seem buggy To : netscape.public.mozilla.jseng From : Martin Honnen Date : Wed May 25 2005 06:57 pm Mark Turansky wrote: > The most important thing to note here is the index [0], because in my script > below this will not work. > > This fails with "Error in javascript: TypeError: undefined is not an xml > object. (C:\projects\jsx\root\testhtml.jss#8)". Line 14 is > > 1 var html = ; > 2 html.head.title = "My Page Title"; > 3 html.body.@bgcolor = "#e4e4e4"; > 4 html.body.form.@name = "myform"; > 5 html.body.form.@action = "someurl.jss"; > 6 html.body.form.@method = "post"; > 7 html.body.form.@onclick = "return somejs()"; > 8 html.body.form.input[0].@name = "test"; // also fails if line 7 > is: html.body.form.input[0] = "" There is indeed a difference between Rhino and Spidermonkey, with the test case being default xml namespace = 'http://www.w3.org/1999/xhtml'; var html = ; html.head.title = "My Page Title"; html.body.@bgcolor = "#e4e4e4"; html.body.form.@name = "myform"; html.body.form.@action = "someurl.jss"; html.body.form.@method = "post"; html.body.form.@onclick = "return somejs();"; html.body.form.input[0] = ""; print(html) html.body.form.input[0].@name = "test"; print(html); Spidermonkey gives My Page Title
My Page Title
while Rhino shows My Page Title
js: "C:\Dokumente und Einstellungen\All Users\Dokumente\javascript\test200505250 1.js", line 12: uncaught JavaScript runtime exception: TypeError: undefined is not an xml object. so where Rhino fails to create an object is on the line with html.body.form.input[0] = ""; -- Martin Honnen http://JavaScript.FAQTs.com/ .