Okay, I created a stripped-down version of the extension
that only contains statements to print-to-error-console to
show the values of relevant variables. Download the files:
http://www.iceapps.com/meanings20120402.zip .
There is a readme.txt file in there somewhere that notes
how to make the directory structure work on linux. I have
not tried working with extensions on windoze, so I have
no idea what needs to be changed to work on windoze.
Let me know if the behavior is different for you. On my
computer, no matter what I do, the event listener function
for the window load event executes *immediately* when
the window.open() function is called, before the line
after the window.open() function call executes.
You can verify all this by starting the browser, browse
to some webpage with normal HTML text, then click
on some word in the text. Inside the mousedown event
listener function the window.open() function is called,
which displays a long, thin window just below where
you clicked the mouse. Then go click on a word in
that new window too, to create a complete record in
the error window. Then display the "error console",
in the Tools => WebDeveloper menu and scroll down
through the information my meanings.js javascript
code prints out.
There you will clearly see three things:
1: window.open() invokes "load event handler".
2: can't find the window or its contents in the "load event
handler"
3: can't find the window or its contents after window.open()
returns.
The one exception to #3 is that
cw.name DOES
report the correct window name as supplied in the
second argument of window.open() - namely "clarify".
However, nothing else is correct. Note, for example,
that it can't find the "clarify" ID within the tiny window,
and it can't find the <p> or <b> or <i> tags in the
tiny window either.
I put visible ENTER FUNCTION and LEAVE FUNCTION
printouts for both those event handler functions, so it is
very easy to see how the program flow goes. Everything
is started by a mousedown event (within a text node).
Inside the mousedown event handler the code calls the
window.open() function, which immediately causes the
windowload event handler to execute, then return to
the line after window.open(). You'll see that clearly.
And you'll also see that the information about the
window and its contents are WRONG, both inside
the window load event handler and also inside the
mousedown event handler after the window.load()
function is called and the windowload handler is
finished executing.
Download the files here:
http://www.iceapps.com/meanings20120402.zip