Now we can get our hands on an iPhone, developers are testing out Safari to see what is actually available. How is the DOM? What events get fired? How does the keyboard send onkey* events? How is scrolling handled? How is the JavaScript support?
Abe Fettig has been jotting down his notes, which include:
- Poking around the DOM, I don’t see any special objects, with the possible exception of window.offscreenBuffering (set to true).
- Bookmarklets work, although you have to go through the bookmarks menu to get to them.
- Safari crashes are handled gracefully - the main screen fades back in, and you can jump right back into Safari. It will then load page you were visiting when it crashed.
- Drag and drop, and other behaviors based on picking up mousemove events, don’t work. CSS-based element drag and drop doesn’t work either. Dragging one finger around the iPhone’s version of Safari causes the window to scroll, and that’s it. I assume that scroll events do work. I’m sure somebody is already working on a version of drag and drop based on window scrolling.
- For documents with no width set, the iPhone uses a default width of 980px.
Joe Hewitt isn’t too happy with his experiments:
My first task has been exploring the DOM events that you can handle. You do not get “mousedown” when you touch the screen. You get “mousedown” and “mouseup” at the same time when you release your finger. The “mousemove” event does not seem to fire at all. There is no way to handle double-clicking because that is the action for zooming, and calling event.preventDefault() doesn’t seem to override that.
If Safari is the current SDK, we need help as developers to build, and debug, applications.