On Feb 21, 5:47 pm, Remi Grumeau  <[email protected]> wrote:
> >> Didn't thought about it, pretty good point! I should prototype that.
> >> But I think what would "cost less" browser memory usage would be to check 
> >> if new anchor value is an existing screen (then perform followAjax() as 
> >> now) and if not, just perform default browser behavior.
> >> Result would more or less be the same but wouldn't require parsing current 
> >> screen DOM to find all a elements and test each name values.
>
> > You don't have to parse anything, use getElementsByName, e.g.
>
> > var isAnchor = (function() {
> >  var re = /^#/;
> >  return function (s) {
>
> >    if (re.test(s) &&
> >        document.getElementsByName(s.replace(re,'')).length) {
>
> >      // s is an anchor
> >      alert(s + ' is an anchor');
> >      return true;
> >    }
>
> >    alert(s + ' is not an anchor');
> >    return false;
> >  };
> > })();
>
> > If you want to be certain, you can iterate over the collection
> > returned by getElementsByName to see if one has tagName A.
>
> Well, this would work but would select all <a> of the Dom,

getElementsByName() will only select every a in the DOM if every A
element has the same name, which would play havoc with anchors anyway.


> not the actual screen only so you would first need to limit the search to it 
> + this code.

I think you've misunderstood the code I posted.


> On the other hand, only
> if($(anchorvalue))
> would do the job.

I don't know what that would do.  But I see from your other posts that
you've got the idea that you can detect links to anchors using the
existing, standards compliant naming scheme rather than introducing a
customised system.

--
Rob

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to