"The getPreventDefault () method should no longer be used. Instead, use defaultPrevented "

5

In some browsers, such as Google Chrome , always when in "mexo" in some element of the page, the following message appears:

  

event.returnValue is deprecated. Please use the standard event.preventDefault () instead

Or:

  

Use of getPreventDefault () is deprecated. Use defaultPrevented instead

In my Firefox 39, it appears:

  

The getPreventDefault () method should no longer be used. Instead, use defaultPrevented ..

I am concerned about development whenever I see or hear the word Deprecated or Deprecated .

After all, what causes this message?

Does this refer to the event.preventDefault() we usually use with eventListener and / or jQuery ?

    
asked by anonymous 11.08.2015 / 13:39

1 answer

6

As the JavaScript language itself is evolving and new standards are being adapted, some old features and methods are being left behind. In other words, they are "deprecated" and this means that in the future they will stop working.

It is always important to "keep the code", that is, to update it so that you do not have any errors in new Browsers.

In case you are using a library, just change the version to a newer one and test the code to see if everything works in the same way, without errors.

If it is your own code, look for the method that replaces the old one and change it.

In the case of getPreventDefault() this was an idea from Mozilla that was removed . The idea was to know if at a given event .preventDefault() had been called. The standard method for doing this is event.defaultPrevented .

In the case of .returnValue this was an idea from Microsoft (Internet Explorer) and was used to cancel / stop events. It was also abandoned by the current standard that is event.preventDefault(); .

    
11.08.2015 / 13:51