7/01/2007

iPhone JavaScript window events

I've been investigating event hook availability in JavaScript on the iPhone. If you want to look at the script I've been using for this, you may find it at:

http://homepage.mac.com/tahoma.toelkes/iPhoneWindowEvents.html


Please be kind with your comments, since I've only been hacking JavaScript off and on over the last 48 hours or so (and I "borrowed" the basis for this script, as the comment at the top of it indicates). ;-)

Anyway, so far, I've been primarily concentrating on the global window events, and I've discovered a few tidbits that other might perhaps find interesting.

1. Starting on the third screen orientation flip, the window object starts getting its onresize event hook called...every time. Why doesn't it happen the first two times? I don't know, but I suspect it's a bug, and I'm going to file it as such soon.

2. Sometimes, when I click a checkbox, I get the following event stream at the window object: onmouseout, onmouseover, onmousedown, onmouseup, onchange, onclick. Other times, I get this simpler stream: onmousedown, onmouseup, onchange, onclick. Also, I've had both sequences without the onchange event (with the expected result that the checkbox state doesn't change. As yet, I've been unable to determine what causes the differences.

3. I have witnessed onmousewheel events while zooming using the pinch gesture; however, again, I've been unable to correlate when it happens to any differences in how I'm manipulating the screen. Grrrr!

Okay, I think it's about time to dive into textarea hooks. I'm going to leave the script I mentioned above static while I'm doing that experimentation. If I do update it later, I'll mention the fact in this blog.

Cheers!


-- Tahoma