<div> and <span> does not support an onclick javascript handler

RESOLVED INVALID

Status

()

RESOLVED INVALID
15 years ago
11 years ago

People

(Reporter: gschulz, Unassigned)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a2) Gecko/20040714
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a2) Gecko/20040714

The <div> and <span> elements does not support an onclick javascript handler
like <div onclick="submit();">

it works fine in 1.6 but not in 1.7. Why?

However i seams to be possible to assign the needed handler using the dom api, like:
var span = document.createElement('Span');
span.onclick = function() { ... };

Any ideas?

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
onclick is supported fine.  "submit" is not a property of <div> or <span>,
though, and the scope chain changed in 1.7....
(Reporter)

Comment 2

15 years ago
(In reply to comment #1)
> onclick is supported fine.  "submit" is not a property of <div> or <span>,
> though, and the scope chain changed in 1.7....

I just tested it again
<div onclick="alert();"> content </div> does not work.
Any idea how the scope chain changed in 1.7

Comment 3

15 years ago
GSchulz, this file
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1201497
says that the alert method requires a string parameter.
<div onclick="alert('string message');"> content </div>
works for me accordingly, as expected, with no reported javascript console error
in Mozilla 1.8a3 build 2004072608 under XP.

Can you have a look at

Bug writing guidelines
http://www.mozilla.org/quality/bug-writing-guidelines.html

and, from now on, post an url, explicit steps to reproduce along with a working
testcase (whenever suitable and preferably with entirely valid markup code) for
possible bugs you see. This is how you can best help bugzilla volunteers trying
to triage possible bugs and help the process of confirming and resolving bugs.
Thanks.
> Any idea how the scope chain changed in 1.7

We no longer try to look up identifiers in the scope of every ancestor of the
event target.

Comment 5

14 years ago
Marking this INVALID, as per comment #3.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID

Updated

11 years ago
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.