Closed Bug 315857 Opened 19 years ago Closed 12 years ago

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

Categories

(Core :: XUL, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: didier.moraine, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

614 bytes, application/vnd.mozilla.xul+xml
Details
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,..."/>
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
This bug has been fixed in firefox 1.5.0.7

As our workaround for this problem is no longer required.
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
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.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: