Last Comment Bug 708702 - Use defaultPrevented instead of the deprecated getPreventDefault() in front-end code
: Use defaultPrevented instead of the deprecated getPreventDefault() in front-e...
Status: RESOLVED FIXED
[good first bug][lang=js]
:
Product: Thunderbird
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All All
: -- trivial (vote)
: Thunderbird 13.0
Assigned To: Nguyen Ngoc Trung
:
:
Mentors:
Depends on:
Blocks: 691151
  Show dependency treegraph
 
Reported: 2011-12-08 10:09 PST by Dão Gottwald [:dao]
Modified: 2012-02-13 13:00 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Propose patch (4.64 KB, patch)
2012-01-31 12:40 PST, Nguyen Ngoc Trung
standard8: review+
Details | Diff | Splinter Review

Description Dão Gottwald [:dao] 2011-12-08 10:09:22 PST
+++ 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
Comment 1 Nguyen Ngoc Trung 2012-01-19 09:38:07 PST
I would like to try this bug.
Comment 2 Dão Gottwald [:dao] 2012-01-19 09:43:08 PST
Great! Let me know if you need help.
Comment 3 Nguyen Ngoc Trung 2012-01-25 11:13:56 PST
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?
Comment 4 Dão Gottwald [:dao] 2012-01-25 11:19:19 PST
You can just leave out jquery-1.6.4.min.js. It will automatically use defaultPrevented if getPreventDefault isn't defined.
Comment 5 Nguyen Ngoc Trung 2012-01-31 12:40:00 PST
Created attachment 593188 [details] [diff] [review]
Propose patch

Please check if I did this right. Thank you.
Comment 6 Dão Gottwald [:dao] 2012-01-31 12:51:34 PST
Comment on attachment 593188 [details] [diff] [review]
Propose patch

Looks good to me.
Comment 7 Mark Banner (:standard8, limited time in Dec) 2012-02-08 15:22:01 PST
Comment on attachment 593188 [details] [diff] [review]
Propose patch

Looks good, thanks for the patch.
Comment 8 Mark Banner (:standard8, limited time in Dec) 2012-02-13 13:00:54 PST
Checked in: http://hg.mozilla.org/comm-central/rev/a489b0bb0a7f

Thanks for the patch.

Note You need to log in before you can comment on or make changes to this bug.