vivekian wrote:
Quote:
In one of the javascript functions , i need to get the ids of the
elements. This function works in Internet Explorer :
>
var TabNames = ParentTab.childNodes ;
>
for ( i = 0 ; i < TabNames.length ; i++ )
{
var TabID = TabNames[i].getAttribute('id') ;
var TabIDSuffix = TabID.split (Splitter) ;
>
if ( TabIDSuffix[0].length != 0 )
{
if ( TabIDSuffix[0] == URLTab )
{
result = true ;
break ;
}
}
>
}
// TabNames is the array of divs which are enclosed in the parent div.
>
But in Firefox it gives an error saying :
Error: TabNames[i].getAttribute is not a function
You are hitting the phantom nodes problem on Gecko-based browsers
<http://en.wikipedia.org/wiki/Phantom_nodes>
You have to add extra check to sort out element nodes and parasite text
nodes from your pretty-print. See for instance
<http://developer.mozilla.org/en/docs/firstChild(skip on pathetic
arguments why phantom nodes are not a bug and see the samples
themselves).
You can also use anti-phantom pretty-print:
<body
Quote:
><p>Content</p
><p>More content
....
but unless you have an automation script (mine is on Perl) that's a
boring doing.