zepto
zepto copied to clipboard
ScrollToFixed throws an error on 't.isImmediatePropagationStopped'
I am trying default ScrollToFixed functionality using Zepto. So, I setup a jsBin:
- Included default zepto build
- Setup
jQuery
as$
- Include the
selector
module seperately to provide support for:visible
- Included ScrolToFixed
- 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.
@mislav sounds like a possible bug with the event code
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.