You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Clint Harris <cl...@yahoo.com> on 2005/06/05 16:57:14 UTC

Resolved: JavaScript on Lenya "Site" Tab Fails

--- kipkerplunk-lenya@yahoo.com wrote:

> The site navigation tree (accessed by clicking on the "Site" tab in
> authoring mode) doesn't work in certain versions of Lenya and for
> certain versions of Netscape.

--- gregor@apache.org wrote:

> during the development of 1.2.3, the sitetree js was rewritten to be 
> AJAX-based for better performance. it seems you are seeing problems 
> related to that rewrite.
>
> i am curious why nn 7 would fail when ie 6 works given that nn 7 has 
> the more modern js implementation. can you try to figure out more
> details about the nn 7 situation? it seemed to me you were not
running
> against the same lenya in your tests.

Again, I have confirmed that this bug exists in Lenya 1.2.3 and
1.2.4-dev. It is only an issue for Netscape 7.0 and 7.1. However, I
have found the problem and would like to propose a solution.

First, a quick description of how the navigation tree on the "Site" tab
works (for those who aren't familiar with it but want to understand the
resolution). Basically, JavaScript is used to retrieve the navtree's
data as XML and then model it using a custom JavaScript data structure
-- a tree that is capable of rendering itself as a pretty menu on the
page. [ on a side note, the XML is retrieved synchronously so I guess
you could call it SJAX. ;) ]

While the JavaScript tree is being built, a few conditional checks are
done on the XML source. Specifically, tag names of the various nodes
are tested. For example:

if( children[i].tagName == 'nav:label' )

This line checks to make sure the XML tag is "<nav:label>". However,
this is where the problem lies for some versions of Netscape (due to
how the DOM elements interface is implemented). The .tagName property
does NOT include the namespace prefix in NN 7.0/7.1. Continuing the
example above, this means that 'label' is returned instead of
'nav:label'. This fails the test of course (in several locations in
navtree.js), causing the whole thing to barf.

I have been able to fix this problem on my own Lenya 1.2.3 installation
by adding the following little "helper" function to navtree.js:

function getTagName(element) {
  var tagName = element.tagName;
  var prefix = element.prefix;

  if(tagName.indexOf(prefix + ':') == -1) {
    tagName = prefix + ':' + tagName;
  }

  return tagName;
}

By using this function, you're ensuring that the prefix is always
included. The usage example from above becomes:

if( getTagName(children[i]) == 'nav:label' )

It's unfortunate that you have to include something like this just for
one browser's DOM implementation, but that's life in JavaScript-land.
If the Lenya developers think this is an acceptable solution, I would
hope that they included it Lenya 1.4.

Can someone follow-up on this and put it in Lenya's bugtracker?

clint

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Resolved: JavaScript on Lenya "Site" Tab Fails

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Gregor J. Rothfuss wrote:
> Clint Harris wrote:
> 
>> It's unfortunate that you have to include something like this just for
>> one browser's DOM implementation, but that's life in JavaScript-land.
>> If the Lenya developers think this is an acceptable solution, I would
>> hope that they included it Lenya 1.4.
>>
>> Can someone follow-up on this and put it in Lenya's bugtracker?
> 
> 
> thanks!
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=35227

patch works in ff and ie. can you test against nn 7?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Resolved: JavaScript on Lenya "Site" Tab Fails

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Clint Harris wrote:

> It's unfortunate that you have to include something like this just for
> one browser's DOM implementation, but that's life in JavaScript-land.
> If the Lenya developers think this is an acceptable solution, I would
> hope that they included it Lenya 1.4.
> 
> Can someone follow-up on this and put it in Lenya's bugtracker?

thanks!

http://issues.apache.org/bugzilla/show_bug.cgi?id=35227

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org