Closed Bug 305217 Opened 19 years ago Closed 19 years ago

Event listeners fire on registration during event

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: schontz+bugs, Unassigned)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

Using the following code:

document.addEventListener("click", function() {
  alert("listener 1");
  document.addEventListener("click", function() {
    alert("listener 2");
  }, false);
}, false);

You should only get one alert the first time you click on the document. I'm
getting both alerts. Please see:
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-registration

Reproducible: Always
Related to/duplicate of Firefox bug 303744?
No. This bug is not a duplicate of bug 303744. It doesn't have to do with the
functions being anonymous. What should happen:
- First click alerts 'listener 1'. Second click alerts 'listern1' and 'listener2'

What does happens:
- First click alerts 'listener 1' and 'listener 2'
Worksforme on a trunk Linux build.
Fixed by bug 174320.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Depends on: 174320
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: