Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

Element#index method

#383

@bebraw asked for this one, it should return the index of the element among his siblings

Reported by MadRabbit · October 20th, 2010 @ 01:56 PM

State: resolved
Milestone: 2.2.0 Release
Assigned to: nobody

Activity

  1. xmory
  2. MadRabbit
    MadRabbit

    just an implementation note

    function() {
      var node = this.parentNode.firstChild, index = 0;
      while (node !== this) {
        node = node.nextSibling;
        index ++;
      }
      return index;
    }
    

    that should work faster than childNodes iteration. I think. gotta check it out.

    December 25th, 2010 @ 08:32 PM

  3. MadRabbit
    MadRabbit
    • State changed from new to resolved

    December 26th, 2010 @ 06:20 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.