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.
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.
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
Created attachment 202505 [details]
Textbox with a onfocus event
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 188.8.131.52
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.