Dear developer, I digged into it with a colleague.
We modified the JavaScript-method to:
-------------------
function portalInit() {
[....]
if(document.getElementById("menu")){
[...]
// close the menu if user clicks anywhere but not in it
[issue15450]
kwCommon.addEvent(document.getElementsByTagName('body')[0],
"click",
function(event){
if(document){
-->
document.getElementById("menu").collapseUnfocused(event)
}
}, false); //all browsers
}
[....]
---------------
I searched in the htmlunit-Code
(HTMLDocument<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html>)
and found:
-----
214<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#214>
@SuppressWarnings("unchecked")
215<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#215>
public <N extends DomNode> N getDomNodeOrDie() throws
IllegalStateException {
216<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#216>
try {
217<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#217>
return (N) super.getDomNodeOrDie();
218<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#218>
}
219<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#219>
catch (final IllegalStateException e) {
220<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#220>
final
DomNode<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/html/DomNode.html>
node = getDomNodeOrNullFromRealDocument();
221<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#221>
if (node != null) {
222<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#222>
return (N) node;
223<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#223>
}
224<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#224>
throw Context.reportRuntimeError("No node attached to this
object");
225<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#225>
}
226<http://htmlunit.sourceforge.net/xref/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.html#226>
}
------------------------
It looks like a Bug in Htmlunit, I'm right?
What's the next step?
Greetings
Michael
Michael Habbert
Key-Work Consulting GmbH | Kriegsstr. 100 | 76133 Karlsruhe | Germany |
www.key-work.de<http://www.key-work.de>
Fon: +49-721-78203-269 | E-Mail:
[email protected]<mailto:[email protected]> | Fax:
+49-721-78203-10
Key-Work Consulting GmbH, Karlsruhe, HRB 108695, HRG Mannheim
Geschäftsführer: Andreas Stappert, Tobin Wotring

