Closed Bug 253267 Opened 20 years ago Closed 19 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: gschulz, Unassigned)

References

Details

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....
Depends on: 242557
(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
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.
Marking this INVALID, as per comment #3.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
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.