From: Brad C. <yo...@br...> - 2005-04-27 02:41:06
|
The goal of HtmlUnit is the be able to emulate the browsers as closely as possible. It sounds like we're calling onload earlier than browsers are and we should fix that. Any example failing test cases would be very helpful in finding the proper time to call onload. Brad C --- Dave Kosenko <dko...@ve...> wrote: > This may well be beyond the intended functionality scope of HTMLUnit, so do > feel free to > tell me to bugger off... > > I've been having some trouble with a page with javascript - the > functionality contained in the > javascript seems to not be working when run with htmlunit. In particular, > an onload() function > set in the javascript does not execute. > > The code in question (and I must emphasize that this isn't my code, but > rather code inserted > by a 3rd-party software utility to do performance monitoring of web pages) > works as follows: > Javascript in the original html page does a document.write() to bring in 2 > files from the web > server containing additional javascript code. That javascript code in turn > gathers a bunch of data > then does another document.write() to insert more javascript code into the > page. That second > document.write() adds function definitions for window.load() and > window.unload(). > > It seems that as long as the onload function is defined in javascript in > the original html page, the > function gets executed fine. However, with the onload function being set > as a result of the code > added via document.write(), it does not get executed. Tracing the call to > executeOnLoadHandlersIfNeeded > shows that, at the time it is called, the onload function has not yet been > defined. > > So I guess my question is, would this be considered a bug (since the > behavior differs from that in a > browser)? Or is such functionality beyond the current scope of the software? > > Thanks for all the help so far. > Dave > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |