User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 (ax) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 (ax) There is a difference of context for the 'this' object according to which event you use. Inside the onclick event, 'this' refers to the <texbox> XULElement. Inside the onfocus event, 'this' refers to the <html:input> HTMLInputElement part of the texbox binding. Reproducible: Always Steps to Reproduce: 1. In a XUL page, create a texbox like this: <textbox onfocus="alert('onfocus\nthis = ' + this);" onclick="alert('onclick\nthis = ' + this)"/> 2. Click on the textbox. Expected Results: I expect that the 'this' object refers also to the texbox XULElement inside the onfocus event. This happend in Firefox 1.0.7 and in Firefox 1.5RC1
Confirming, this is similar to bug 248324. This happens because the xul:textbox binding uses <html:input ... xbl:inherits="onfocus,onblur,..."/>
This bug has been fixed in firefox 126.96.36.199 As our workaround for this problem is no longer required.
Probably a duplicate of Bug 313573.
This was resolved partially by bug 334216 (which allowed the event to fire with the right "this" object) and partially by bug 732738 (which removed the bogus version of the event that fired with the wrong "this" object). As I can't duplicate this against both bugs, I won't bother duplicating it against either.