Bug Tracker

Changes between Initial Version and Version 1 of Ticket #7841, comment 3


Ignore:
Timestamp:
Dec 27, 2010, 5:49:39 PM (10 years ago)
Author:
ajpiano
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7841, comment 3

    initial v1  
    33A) WRT to your first point: It is generally considered to be a poor practise to use binding anonymous functions to native events as a method of code organisation.  If there is logic that needs to happen "when a scroll would have occurred," whether or not a scroll occurred, it makes much more sense to encapsulate that logic in a function and call that function from an actual window scroll, than it does to encapsulate that logic in a window scroll handler and then try to make the app think the window scrolled.
    44
    5 B) You're right, jQuery does normalise a lot of browser quirks, but because of the very different nature of event handling in different browsers, it is in the events system that these types of issues do pop up.  For instance, jQuery synthetically bubbles the change and submit events in IE altogether, and certainly we have encountered issues with that over time.  I don't know if you've ever tried doing .trigger("click") to simulate click events, but it is not, in fact ,the same as an actual user clicking the element - certain native behaviours (like following a link) simply do not happen.  The reasoning that jQuery is a library that normalizes cross-browser issues, therefore if you find a cross-browser issue, jQuery should automatically find a way to normalise, in a word, circular.
     5B) You're right, jQuery does normalise a lot of browser quirks, but because of the very different nature of event handling in different browsers, it is in the events system that these types of issues do pop up.  For instance, jQuery synthetically bubbles the change and submit events in IE altogether, and certainly we have encountered issues with that over time.  I don't know if you've ever tried doing .trigger("click") to simulate click events, but it is not, in fact ,the same as an actual user clicking the element - certain native behaviours (like following a link) simply do not happen.  The reasoning that jQuery is a library that normalizes cross-browser issues, therefore if you find a cross-browser issue, jQuery should automatically find a way to normalise it, in a word, circular.
    66
    77C) Your fix of adding a preventDefault call is a perfectly reasonable fix - for your application.  If you want to stop IE8's default behaviour on a synthetic scroll event, it is typical: people have to use  event.preventDefault in myriad contexts and applications for just this type of problem.  Whether it is an appropriate solution to be added to every single scroll event jQuery ever binds in any application ever cannot be determined readily.