soyjavi / QuoJS

Micro #JavaScript Library for Mobile Devices
MIT License
2.07k stars 236 forks source link

QUOJS Blocks jQuery Click Events on Mobile #144

Closed tarikbenmerar closed 9 years ago

tarikbenmerar commented 9 years ago

Hello,

When integrating QuoJS on a page containing jQuery, all the jQuery click events are blocked. How to resolve this ?

Thanks,

soyjavi commented 9 years ago

Can you show me a example?? because QuoJS namespace is $$ ...

tarikbenmerar commented 9 years ago

Something as simple as $(body).click(function () { alert('clicked'); });. Now as a workaround I made a hack on this line https://github.com/soyjavi/QuoJS/blob/master/source/quo.gestures.coffee#L28 to stop propagation when there is a specific data attribute existing to allow jQuery events on that element. And it worked. Now, I am thinking of doing the inverse to activate the QuoJS only on a certain element.

Hope, that's clear for you about the issue.

soyjavi commented 9 years ago

Ok, I understand... maybe you can send a pull request to the repository.. right?

tarikbenmerar commented 9 years ago

@soyjavi sorry for my late response. I have done the changes directly on the minified script. I have done something like this on that line:

return ev.stopPropagation() if (ev.srcElement or ev.target).tagName.toLowerCase() in _disabled_tags || (ev.srcElement || ev.target).getAttribute('data-no-propagate') !== null;

In this way, by adding that attribute (data-no-propagate) the event is not propagated to the document level, this lets jQuery manages the event.

So, it is just hack. Not something to be merged. I hadn't the sufficient to investigate more.

soyjavi commented 9 years ago

IMHO I wonder that if you use QuoJS it isn't necesary use jQuery and viceversa... but I will think a solution.

tarikbenmerar commented 9 years ago

@soyjavi the issue is that I needed some bootstrap UI stuff, and I am developping a cross-devices application. Sometimes, I use jQuery sometimes it is QuoJS. But, in the end I need them both to coexist. I have a workaround now. I will come back to this issue later if I can.