<textbox>: Inside the "onfocus" event, the 'this' object refers to the HTMLInputElement and not the texbox XULelement

RESOLVED FIXED

Status

()

Core
XUL
RESOLVED FIXED
12 years ago
5 years ago

People

(Reporter: Didier Moraine, Unassigned)

Tracking

({testcase})

Trunk
x86
Windows XP
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

614 bytes, application/vnd.mozilla.xul+xml
Details
(Reporter)

Description

12 years ago
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
(Reporter)

Comment 1

12 years ago
Created attachment 202505 [details]
Textbox with a onfocus event

Comment 2

12 years ago
Confirming, this is similar to bug 248324. This happens because the xul:textbox binding uses
 <html:input ... xbl:inherits="onfocus,onblur,..."/>
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase

Comment 3

11 years ago
This bug has been fixed in firefox 1.5.0.7

As our workaround for this problem is no longer required.

Updated

9 years ago
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets

Comment 4

7 years ago
Probably a duplicate of Bug 313573.

Comment 5

5 years ago
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.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.