>> 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.
>
>
> --
> Rob
Well, this would work but would select all <a> of the Dom, not the actual
screen only so you would first need to limit the search to it + this code.
On the other hand, only
if($(anchorvalue))
would do the job.
R.
--
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.