zepto icon indicating copy to clipboard operation
zepto copied to clipboard

ScrollToFixed throws an error on 't.isImmediatePropagationStopped'

Open saravanak opened this issue 9 years ago • 2 comments

I am trying default ScrollToFixed functionality using Zepto. So, I setup a jsBin:

  1. Included default zepto build
  2. Setup jQuery as $
  3. Include the selector module seperately to provide support for :visible
  4. Included ScrolToFixed
  5. Included zeptoExtras , to provide outerWidth

If you load the page, you will see that there are errors in the console: Uncaught TypeError: e.isImmediatePropagationStopped is not a function

I debugged the issue, and there seems to be a call to preventDefault on the ScrollToFixed's detach.ScrollToFixed event. See https://github.com/madrobby/zepto/blob/master/src/event.js#L129 for the compatible function, which tries to add the isImmediatePropagationStopped function to the event object. But since the preventDefaults is already called for detach.ScrollToFixed, the event doesn't seem to 'enter' the compatible function ,and hence misses the function definition.

So is this a zepto issue? I think so , because the same code, when run against jQuery , runs fine.

saravanak avatar Jun 14 '15 23:06 saravanak

@mislav sounds like a possible bug with the event code

madrobby avatar Jul 12 '16 15:07 madrobby

I ran into the same problem, however just by including zeptoExtras.

This section at the end seems to be the culprit:

// For dateinput
Event.prototype.isDefaultPrevented = function() {
    return this.defaultPrevented;
};

After removing these lines it works for me.

jacobmellin avatar Mar 04 '17 15:03 jacobmellin