Posts Tagged ‘Safari’

Be careful with the sandbox

Posted: February 2, 2009 in Technology
Tags: , , ,

This customization of Ext JS TreeLoader can create a negative side-effect on Safari and Chrome in a very narrow use case. The issue that I ran into happens when the folder node was empty and when you drop a leaf node into it. In the sandBox function shown in the above link, it would return one level of children for the given clicked parent node. This is a nice way to build a scalable tree that can be very deep. When combining this with drag-and-drop, it can result in two new nodes for a given dropped leaf node. This was caused by the interaction with the listener for beforenodedrop event, which updates a store with the new association to the target node. This caused the look-up code in sandBox function to retrieve the newly associated leaf node and caused the UI to display one extra dropped node. The other node comes from the drag-and-drop action. To resolve this, I had to crate the whole tree on the initial tree load instead of creating each level on-demand.

While debugging this issue, I learned that Safari and Chrome actually behaves differently. Safari would consistently add two nodes while Chrome would only add two nodes with a particular work-flow sequence. i.e. create one folder node, then drag-and-drop a leaf node, create another folder node, and drag-and-drop a second leaf node works fine. It starts to create two nodes when creating two folders in a row and then drag-and-drop leaf nodes. Before this, I thought the two browsers are essentially the same. After experienced this, I had a totally different view about them.

I encountered a JavaScript issue on Safari while the same script works fine on Firefox and IE. Based on what I could find, WebKit appears to be the only bundle that contains a JavaScript debugger. Since WebKit is the open source web browser engine that Safari uses, it essentially is the bleeding edge of what Safari might pick-up later. This can be a good thing that if a fix goes into WebKit now, you can safely expect Safari will pick it up sometime in the future. At the same time, before Safari pick up the fix, you are essentially at a crippled state. I hope Safari has a faster release cycle.