try el.up() On Jun 5, 6:36 pm, "Gareth Evans" <[EMAIL PROTECTED]> wrote: > According to the code and the documentation, the traversal methods extend > elements. > I should stress that if I remove the .classNames part, it still errors on > the up() > > eg: > var el2 = el.up(1); > > We know that el is extended because it's been through a call to $. > > el2 is null. > > Gareth > > On 6/6/07, David Dashifen Kees <[EMAIL PROTECTED]> wrote: > > > > > Do the DOM traversal functions return extended elements? It might be > > that "this" is an extended element so you can call $(this).up() (or > > perhaps just this.up()?) but then the element returned from the up() > > function may not be extended and, therefore, has no next() method. Not > > sure if this is the case, just what jumped out at me from the get-go. > > > - Dash - > > > Gareth Evans wrote: > > > Ok, I'm cracking up due to lack of food or something > > > >http://202.49.89.140/test.html > > > > This works, it's a stripped implementation of the test page. > > > > The code in the context of my page, slightly modified doesn't. > > > > var el = $(this._relative); > > > alert(el.id); > > > alert(el.parentNode.parentNode.classNames()); > > > alert(el.up(1).classNames()); > > > > The first alert, returns the expected element's id. > > > > The grandparent of the element doesn't have an Id, so I've switched to > > using > > > its className to identify it. > > > The second alert returns the correct class name. > > > > The third alert errors: > > > > IE: > > > Object doesn't support this property or method > > > > Firefox: > > > Error: Selector.findElement is not a function > > > Source File:http://localhost:1694/Listz/Javascript/prototype.js > > > Line: 1435 > > > > What else should I check? > > > > Gareth > > > > On 6/5/07, Gareth Evans <[EMAIL PROTECTED]> wrote: > > > >> Thanks, i'll remember that but the actual methods are throwing errors, > > not > > >> method calls to the elements they should return > > >> I'm just implementing the test page from > > >>http://www.prototypejs.org/api/element/next > > >> to see if i'm doing something odd... > > > >> Gareth > > > >> On 6/5/07, Thomas Fuchs <[EMAIL PROTECTED] > wrote: > > > >>> You probably mean: > > > >>> $(this).up(1).next(); > > > >>> Indexes start with 0 for the traversal methods. > > > >>> best, > > >>> Thomas > > > >>> Am 05.06.2007 um 11:17 schrieb Gareth Evans: > > > >>> Hey Guys, i'm trying to traverse the dom and having not much luck. > > >>> Current browser is IE6. > > >>> I have confirmed the element is extended, (_extended:true) as I just > > >>> called Element.extend($(this).parentNode.parentNode) > > >>> What I actually want is $(this).up(2).next(1) but the up and next > > >>> methods are throwing invalid property or method errors. > > >>> I can check the element using the dom viewer as part of the developer > > >>> toolbar, and while the element has methods such as getHeight, > > >>> removeClassName etc there is no Next/Up/Down methods defined. > > >>> Has this changed in 1.5.1? > > >>> Am I doing something wrong? > > >>> I am aware of the IE not properly extending elements issue, which is > > why > > >>> I did the manual Element.extend. > > > >>> Element.extend($( > > >>> this).parentNode.parentNode); > > > >>> //Throws error > > > >>> alert($(this).parentNode.parentNode.next()); > > >>> On further inspection, this syntax isn't working in firefox either: > > it > > >>> throws > > >>> Error: Selector.handlers has no properties > > >>> Source File:http://localhost:1694/Listz/Javascript/prototype.js > > >>> Line: 1457 > > >>> What the--- > > >>> Gareth
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---