On Apr 17, 3:34 pm, RobG <rg...@iinet.net.au> wrote:
[...]
> OK, here is a dead basic proof of concept.  Of course it is nowhere
> near production code, but I think you can see where it's going.  I
> would wrap the entire thing in the module pattern, but I've just used
> basic globals at this stage.  My intention is to show that efficient
> DOM manipulation is possible and that access to related data isn't
> hard.
>
> It took me about 45 minutes to write the entire thing (more than half
> of that was writing the function to generate the test data set),
> tested in Firefox 3 and IE 6 on a 3.4GHz Pentium 4, Windows XP, the
> insert runs in less than 500ms.  I'll test it on the G4 iBook for
> reference later.

Safari 4 on iBook takes around 132ms, Firefox was around 1900.

[...]
> function showData(evt) {
>   var evt = evt || window.event;
>   var tgt = evt.target || evt.srcElement;
>   var data;
>   if (tgt && tgt.tagName && tgt.tagName.toLowerCase() == 'a') {
>     data = dataObj[tgt.id];


    // Should guard against error here
    if (typeof data != 'undefined') {

>
>     // Have data related to this element, do
>     // something with it
>     alert(
>         'Name: ' + data.name
>       + '\nType: ' + data.type
>       + '\nAbout: ' + data.about
>     );

  }

>   }
> }


--
Rob

Reply via email to