From: <Gou...@ne...> - 2003-08-23 00:34:08
|
Hello all. Here are some more comments and news about javascript support. >2: WindowOpen does not work (at least when JavaScript tries to set focus to the newely opened window). window.open works perfect except it is called with url like 'about:blank' or empty string. This causes that window is not initialized than, and does not have a script object. This problem seems to affect also HtmlFrame objects: if one of the frames in the frameset is initialized with 'about:blank', the whole frameset fails to initialize. I'm afraid it will cost a lot of changes in htmlunit to fix it. >3: I have a following line in JavaScript: >parent.<frame_name>.location.href=<some_value>; >this would produce following method calls stack (all in package com.gargoylesoftware.htmlunit.javascript.host): >jsGet_parent in Window >a call to get a frame by name - fails >jsGet_location in Window >jsGet_href in Location > >All jsGet_XXX methods are doing right - I'm pretty sure. >I found out that the call to get frames is handled by >public Object get( final String name, final Scriptable start ) >method in com.gargoylesoftware.htmlunit.javascript.SimpleScriptable, and it would even return a requested frame, if it would be set as a property. >But it is not set: I have modified the get method to print out some debug infos and found out, that SimpleScriptable stores all declared JavaScript functions as properties, but does not contain properties for frames. > >I hope it is not much work to do something similar with frames as it is done with JavaScript functions. I would be obliged if someone would give me any idea what exactly should be done to fix it! In few words: I needed to access frames by name from JavaScript. Now I have a solution: it might not fit to the htmlunit API, but it works. I have modified the com.gargoylesoftware.htmlunit.javascript.host.Window object (see attachment) and marked all changes with >HACK ... <HACK. This IS a hack in this state, cause it might produce some unexpected results for example in case reserved properties names (like 'parent' or 'document') were used as frames names. I would be obliged if someone would review this code and give a feedback. Best regards Alexei Goussev __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 |