brianleroux / xui

A tiny javascript framework for mobile web apps.
http://github.com/xui/xui
391 stars 159 forks source link

BB5 event mapping not working, but "on" method works #53

Closed SamMaxwell closed 13 years ago

SamMaxwell commented 13 years ago

What steps will reproduce the problem?

  1. x$(window).load(function() {alert('this won\'t fire on BB5 (but works on BB4.6, BB4.7 and BB6)');});
  2. x$(window).on('load', function() {alert('this will fire for BB5 (and also works on BB4.6, BB4.7, BB6)');});

What is the expected output? What do you see instead?

either way should work, but only the "on" method works for BB5

What version of the product are you using? On what operating system?

1.0.0 on BB5

Please provide any additional information below.

Both ways work on BB4.6, BB4.7 and BB6

I put an alert inside the "on" method in the xui-bb-1.0.0.js by adding alert('in on '+type); at the end of line 450, just inside the curly brace

when x$(window).load() is called, the alert pops with "in on orientationchange" (in BB5) but says "in on load" (for BB4.6, BB4.7, and BB6)

there's something fishy going on with the xui.fn[event] code at line 529, because when I removed " orientationchange" from the string literal and call x$(window).load(), the alert says "in on gestureend"

apologies

I posted this same issue on the Google code issues list, but it looks like this is the issues list that the contributors use, so I posted it here too.

filmaj commented 13 years ago

Hey Sam,

Have you tried referring to the latest source which is up on github.com/xui/xui and seeing if this is an issue in that build?

If you can give that a try and get back to me I can see if I can help.

SamMaxwell commented 13 years ago

It's fixed in the latest source!

BTW the build script doesn't work on Windows. "cat" isn't a valid command (use "type" instead). Folders in the path need to be separated by "\" instead of "/".

I changed it to work in Windows and could send it to you if you wish.

filmaj commented 13 years ago

Sam,

Thanks a lot! Can you send a pull request from your fork over to the github.com/xui/xui repo? I'll take a look at the source and merge it in and get it up back into the mainline (and you into the contributors list) ASAP.

Thanks, Fil

brianleroux commented 13 years ago

did this make it in the xui/xui mainline?

filmaj commented 13 years ago

Yes it did.

Had to add an anon. function wrapped around the shortcut method creator to "lock" in the scope of each shortcut method name properly on BB. See https://github.com/xui/xui/blob/master/src/js/event.js#L163

brianleroux commented 13 years ago

awesome!