Events assigned by html do not receive event objects.

VERIFIED INVALID

Status

()

VERIFIED INVALID
16 years ago
16 years ago

People

(Reporter: Rob.Jones, Assigned: saari)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

877 bytes, text/html
Details
(Reporter)

Description

16 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021016
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021016

When I assign an event using html intrinsic event properties, eg

<input type="text" id="test2" onKeyDown="foo()" />

The event (foo) does not receive an event object.

Compared with assigning via javascript
document.getElementById('test4').addEventListener('keydown', foo, false);
or
document.getElementById('test5').onkeydown=foo;

In the javascript cases foo is passed a parameter that is an event object.
In the HTML assign it does not get this paramter.

I attach a testcase to demonstrate.


Reproducible: Always

Steps to Reproduce:
(Reporter)

Comment 1

16 years ago
Created attachment 107945 [details]
testcase
Invalid.  

onKeyDown="foo()"

is exactly equivalent to:

document.getElementById('test5').onkeydown=function (event) { foo() };

If you do 

onKeyDown="foo(event)"

instead everything will work properly.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → INVALID

Comment 3

16 years ago
verifying
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.