quirkey / sammy

Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.
http://sammyjs.org
MIT License
2.99k stars 444 forks source link

uuid() method getting overridden in QtWebView preventing firing of events #18

Closed pdelanauze closed 13 years ago

pdelanauze commented 14 years ago

Seems like the this.uuid() sometimes never gets called under certain environments. Specifically with QT 4.6 webkit. Seems like that method is hidden by some core related javascript.

what happens is that the namespace property of the application receives an object when it should retrieve a uuid string, causing the triggering phase to fail when it is called.

A simple renaming of the .uuid method would do the trick As a temporary solution i've replaced the method call to uuid() in the constructor of the application with the actual contents of that method.

Been scratching my head for 3 days on this issue. Glad i found a temporary fix!

Context is as follows:

You'll want to say that my other libs is what's overriding the .uuid() method, but that's not the case, given that the application works on every browser i've tested it on, only the hybrid QtWebView that failed.

Cheers @quirkey and others for an awesome library! Truly amazing!

pdelanauze commented 14 years ago

sammy.js:313

this.namespace = (new Date()).getTime() + '-' + parseInt(Math.random() * 1000, 10);

mrb commented 14 years ago

Nice detective work!

pdelanauze commented 14 years ago

i had to do it, theres no building RIA without sammy ! ;)

quirkey commented 14 years ago

Hey @pdelanauze - is it seriously because of the name of the method? What if it was just called .appID()?

Thanks for testing/discovering this doozy!

pdelanauze commented 14 years ago

I'll test out the integration of .appID() hopefully tomorrow.

quirkey commented 14 years ago

So I realized that the uuid() method is only used in a single place. I removed it, and saved a couple lines of code. Let me know if this fixes your issue: http://github.com/quirkey/sammy/commit/9f69c8492831b435e510d075422de5596214f949