DOM Events

4 views
Skip to first unread message

Joe Hewitt

unread,
Jun 30, 2007, 12:55:44 AM6/30/07
to iPhoneWebDev
I'm testing the bounds of JavaScript on my new iPhone and finding that
it does not dispatch "mousemove" events, and it doesn't dispatch
"mousedown" until you actually release your finger. This is really
bumming me out because I was hoping to whip some some fun touch-screen
apps over the weekend. It seems that double-clicking and dragging,
which are the means for zooming on the page, are always triggered in
favor of giving scripts in the page the ability to handle and override
these events.

I'm hoping we can find a workaround, or that the Webkit team will
announce they have added some new events for handling multi-touch
interaction.

David Cann

unread,
Jun 30, 2007, 1:23:05 AM6/30/07
to iPhoneWebDev
I can confirm this in my testing... and in even worse news, scrollable
divs do NOT have the bounce scroll feature. You can scroll a div with
2 fingers, but you can't flick it. Here's a sample:

http://davidcann.com/div

This, combined with the lack of a mousedown event is terrible news.
Also, have you found Safari to be exceptionally slow at executing
JavaScript? When my digg app is supposed to slide nicely to the left,
it does it in about 3 frames... completely unacceptable. It's no
wonder that Apple didn't implement the side animation in it's WWDC
app!

I hope they can improve on these weaknesses... or we're going to have
a difficult time developing innovative web apps.

-d

BikingBill

unread,
Jun 30, 2007, 1:26:26 AM6/30/07
to iPhoneWebDev
So is mouseup the way to go?

(See the game)

Christopher Allen

unread,
Jun 30, 2007, 2:33:32 AM6/30/07
to iphone...@googlegroups.com
On 6/29/07, Joe Hewitt <joeh...@gmail.com> wrote:
> I'm testing the bounds of JavaScript on my new iPhone and finding that
> it does not dispatch "mousemove" events, and it doesn't dispatch
> "mousedown" until you actually release your finger. This is really
> bumming me out because I was hoping to whip some some fun touch-screen
> apps over the weekend. It seems that double-clicking and dragging,
> which are the means for zooming on the page, are always triggered in
> favor of giving scripts in the page the ability to handle and override
> these events.

There are a lot of events that the iPhone doesn't pass (see my post on
"The Finger is not a Mouse"
http://groups.google.com/group/iphonewebdev/browse_thread/thread/cb37f102133cf8c5
), and many it only simulates partly.

As I understand it clickable elements can get mousedown, mouseup,
mousemove, click events --
clickable elements include links, form, image map area, or with
elements that have elements mousedown, mouseeup, or click. Scrollable
elements such as textareas, iframes, and framesets get scroll events.

The iPhone definately doesn't support onmouseover, cut/copy/paste,
drag/drop, and of course selection.

I'm told that to allow for some types of menus that hover is
supported, but I can't verify this.

Mouseover is supported, however, the problem may be that your
mouseover handler is not inside wht the iPhone thinks is a possible
"clickable" element. You may need to experiment to figure this out. It
is possible that hover may also be a solution for you (but I've never
used it before much less on an iPhone so I'm not a lot of help on that
one).

> I'm hoping we can find a workaround, or that the Webkit team will
> announce they have added some new events for handling multi-touch
> interaction.

As far as I know there are no multi-touch events for the browser. But
who knows as the docs are not out yet.

Good luck, and let us know what you figure out ;-)

-- Christopher Allen

musesum

unread,
Jun 30, 2007, 4:58:31 PM6/30/07
to iPhoneWebDev
Drag and drop doesn't work on iPhone, but works on Safari, with these
examples:

http://www.cyberdummy.co.uk/test/dd.php
http://projects.backbase.com/RUI/portal.html
http://www.openlaszlo.org/lps4/demos/amazon/amazon.lzx?lzt=html&lzr=dhtml

This is not good news.

\~/

Reply all
Reply to author
Forward
0 new messages