-
Notifications
You must be signed in to change notification settings - Fork 640
Open
Labels
Description
previous lighthouse ticket #1357
by Michael Morris
I find myself needing to figure out an element's ordering among its siblings often enough to consider a universal method for it. Consider the following DOM
<ul>
<li id="first">Apple</li>
<li id="second">Orange</li>
<li id="third">Pear</li>
</ul>
The command $('first').index() would return 0, that element's position among its siblings. However, this function wouldn't consider tag types by design. Faced with a mixed tag type collection it still returns the index, but if the user wants nth-of-type they would have to use the proposed sibling function indexOfType.
<div>
<div id="first">Hello there</div>
<section id="second"> Sectioning</section>
<article id="third"> articles</article>
<div id="fourth"> and so on.</div>
</div>
With the DOM above
Thoughts?