Use defaultPrevented instead of the deprecated getPreventDefault() in front-end code

RESOLVED FIXED in Thunderbird 13.0

Status

Thunderbird
General
--
trivial
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: dao, Assigned: Nguyen Ngoc Trung)

Tracking

(Blocks: 1 bug)

Trunk
Thunderbird 13.0

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
+++ This bug was initially created as a clone of Bug #707677 +++

event.getPreventDefault is deprecated, event.defaultPrevented should be used instead.

Affected files:

http://mxr.mozilla.org/comm-central/search?string=getPreventDefault&case=1&find=%2Fmail%2F&findi=&filter=^[^\0]*%24&hitlimit=&tree=comm-central
(Assignee)

Comment 1

6 years ago
I would like to try this bug.
(Reporter)

Comment 2

6 years ago
Great! Let me know if you need help.
Assignee: nobody → trunga0
Status: NEW → ASSIGNED
(Assignee)

Comment 3

6 years ago
Hi Gottwald,
I changed all the depreciated methods except for the file jquery-1.6.4.min.js
Can you help me with this file, I don't fully understand the part that need changing:
http://mxr.mozilla.org/comm-central/source/mail/jquery/jquery-1.6.4.min.js#3
* The part is:
f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0}

I'm just wondering if changing only the a.getPreventDefault&&a.getPreventDefault()?D:C into a.defaultPrevented?D:C  is okay or not?
(Reporter)

Comment 4

6 years ago
You can just leave out jquery-1.6.4.min.js. It will automatically use defaultPrevented if getPreventDefault isn't defined.
(Assignee)

Comment 5

6 years ago
Created attachment 593188 [details] [diff] [review]
Propose patch

Please check if I did this right. Thank you.
(Reporter)

Comment 6

6 years ago
Comment on attachment 593188 [details] [diff] [review]
Propose patch

Looks good to me.
Attachment #593188 - Flags: review?(mbanner)
Comment on attachment 593188 [details] [diff] [review]
Propose patch

Looks good, thanks for the patch.
Attachment #593188 - Flags: review?(mbanner) → review+
Keywords: checkin-needed
Checked in: http://hg.mozilla.org/comm-central/rev/a489b0bb0a7f

Thanks for the patch.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 13.0
You need to log in before you can comment on or make changes to this bug.