From: SourceForge.net <no...@so...> - 2003-09-04 06:38:00
|
Bugs item #799752, was opened at 2003-09-03 12:13 Message generated for change (Comment added) made by akirshin1 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=799752&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrei Kirshin (akirshin1) Assigned to: Nobody/Anonymous (nobody) Summary: Exception: The undefined value has no properties Initial Comment: I use HtmlUnit 1.2.3 I get the error message "The undefined value has no properties." parsing the JavaScript in the following HTML page: <html> <head> <script language='JavaScript'> //<!-- function buggy(){ var option1 = document.f1.elements['select'][0]; option1.value = 'XXX'; // This line causes the exception option1.selected = true; // This line also causes the exception } //--> </script> </head> <body onload='buggy();'> <form name='f1' action='xxx.html'> <SELECT name='select'> <OPTION value='A'>111</OPTION> <OPTION value='B'>222</OPTION> </SELECT> </form> </body> </html> Following is the stack trace: org.mozilla.javascript.EvaluatorException: The undefined value has no properties. at com.gargoylesoftware.htmlunit.javascript.StrictErrorRepor ter.runtimeError(StrictErrorReporter.java:114) at org.mozilla.javascript.Context.reportRuntimeError (Context.java:591) at org.mozilla.javascript.Context.reportRuntimeError (Context.java:630) at org.mozilla.javascript.Context.reportRuntimeError0 (Context.java:600) at org.mozilla.javascript.Undefined.reportError (Undefined.java:138) at org.mozilla.javascript.Undefined.getPrototype (Undefined.java:100) at org.mozilla.javascript.ScriptableObject.getBase (ScriptableObject.java:1585) at org.mozilla.javascript.ScriptableObject.putProperty (ScriptableObject.java:1473) at org.mozilla.javascript.ScriptRuntime.setProp (ScriptRuntime.java:842) at org.mozilla.javascript.gen.c1.call(Embedded script:2) at org.mozilla.javascript.optimizer.OptRuntime.callSimple (OptRuntime.java:275) at org.mozilla.javascript.gen.c4.call (body.onLoad:1) at org.mozilla.javascript.gen.c4.exec (body.onLoad) at org.mozilla.javascript.Context.evaluateReader (Context.java:820) at org.mozilla.javascript.Context.evaluateString (Context.java:784) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngin e.execute(JavaScriptEngine.java:242) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJav aScriptIfPossible(HtmlPage.java:889) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeBod yOnLoadHandlerIfNeeded(HtmlPage.java:1096) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize (HtmlPage.java:173) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:356) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:276) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:220) at ScriptTest.loadPage(ScriptTest.java:45) at ScriptTest.main(ScriptTest.java:31) ---------------------------------------------------------------------- >Comment By: Andrei Kirshin (akirshin1) Date: 2003-09-04 06:37 Message: Logged In: YES user_id=858153 I guess that indexed properties for a select is not implemented. document.f1.elements['select'][0] returns undefined. document.f1.elements['select'].item(0) also returns undefined. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=799752&group_id=47038 |