watusi / jquery-mobile-iscrollview

JQuery Mobile widget plug-in for easy use of the iScroll javascript scroller.
408 stars 183 forks source link

event.layerx and event. layerx are broken and deprecated in Webkit #62

Closed morksinaanab closed 11 years ago

morksinaanab commented 11 years ago

When installing the plugin, using Safari 6.0.2 the console starts giving this deprecated warning over and over again: event.layerx and event. layerx are broken and deprecated in Webkit.

This also was an issue in Jquery, see this ticket: http://stackoverflow.com/questions/7825448/webkit-issues-with-event-layerx-and-event-layery

The problem was :"jQuery probably copies those properties into the jQuery object".

I suspect something similar is going on in this plugin?

jtara commented 11 years ago

WebKit decided they were going to remove layerX and layerY from mouse events. They are not part of any standard. So, they added a deprecation warning. Any attempt to access these properties results in the deprecation warning.

Depending on the particular browser, the warning will be produced either once, or once for each access.

They've since reversed their decision, and won't be removing these, and newer browsers no longer give this warning.

jquery.mobile.iscrollview hijacks iScroll4's even registrations (which are done using the W3C event model) - for logging, and also to block certain event registrations and so that it can support jQuery-style event callbacks. When the widget sends an event to jQuery using the widget factory's_trigger() method, it deep-copies the event, resulting in the deprecation warning.

Starting with jQuery 1.7.2, jQuery avoids copying these properties, but only for events registered using jQuery event registration. The Widget Factory doesn't do this selective copying, but copies it wholesale, so the warning is given during the deep-copy.

I'll add some code to remove these prior to passing these events to jQuery. As well, I'm adding a bit of hacky code to the demo only that will remove the warnings when running the jQuery Mobile 1.0.1/jQuery1.6.4 demo.