Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#16344 closed defect (fixed)

preventDefault() doesn't set evt.defaultPrevented on bubbled event on IE6-8

Reported by: bill Owned by: bill
Priority: undecided Milestone: 1.9
Component: Events Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking: #15097

Description (last modified by bill)

Although calling evt.preventDefault() will set evt.defaultPrevented, when the event bubbles to the parent DOMNode, evt.defaultPrevented is no longer set.

Although dojo/tests/on/on.js has code to test that evt.defaultPrevented is getting set, that code doesn't test what the bubbled event object looks like. But by the existence of that test I assume that it's supposed to work.

Change History (6)

comment:1 Changed 9 years ago by bill

Milestone: tbd1.9
Owner: changed from Kris Zyp to bill
Status: newassigned

There's also an exception accessing lastEvent.type when lastEvent refers to an event that's already finished bubbling, but lastEvent hasn't been cleared by the setTimeout() yet.

I'll check in a fix for both these problems and updated test case to show them.

comment:2 Changed 9 years ago by bill

Resolution: fixed
Status: assignedclosed

In [29961]:

When evt.preventDefault() is called on a listener on DOMNode X, make sure that evt.defaultPrevented is set for listeners on X's ancestors. Also avoid exception accessing lastEvent.type. Fixes #16344 !strict.

comment:3 Changed 9 years ago by bill

Description: modified (diff)

comment:4 Changed 9 years ago by bill

Blocking: 15097 added

(In #15097) Just noting the dependency for the record.

comment:11 Changed 9 years ago by bill

In [29965]:

Fix weirdness in Tree_a11y.html test, avoiding failures (ex: "out of stack space") that for some reason started with [29961]. Refs #16344 !strict.

comment:12 Changed 9 years ago by bill

Re the try/catch in [29961], another approach would be to save the lastEvent's event type and target in separate local variables, and then not access lastEvent at all unless those variables matched. Then we wouldn't need the try/catch at all.

Note: See TracTickets for help on using tickets.