[xul-interop] cloneNode - event handler problem
Thilo Schuler <[email protected]> Wed, 24 Aug 2005 10:43:13 +1000
| Newsgroups | gmane.comp.lang.xul.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I dynamically add instances of a prototype xul node to my document via
the cloneNode(true) and insertBefore methods. Everything works except that
every clone calls the same event handler although I explicitly set
different attribute values (e.g. in the oncommand attribute) before
inserting the clones in the document tree (the different attributes CAN
be appreciated in the dom inspector).
Here is a simplified example
1)Prototype
<button id="proto1" oncommand="" collapsed="true"/>
2) Two cloned and inserted instances
<button id="1" oncommand="alert('foo');" collapsed="false"/>
<button id="2" oncommand="alert('bar');" collapsed="false"/>
Depending on which button I hit first BOTH buttons return either foo OR
bar.
I uploaded this example at http://203.173.42.86/test/clone_test.xul
Interestingly if I make the prototype visible, it also shows the
message of whichever button I had hit first. It seems that the
prototype and its clones are somehow connected and reference only ONE
event handler function.
Any ideas? Using addEventListener is not an option since I can't set
different parameters for the handling function.
Thanks guys, Thilo
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
XUL News Wire - http://xulnews.com
XUL Job Postings - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org