Subselector
Subselector
I was messing around yesterday and came up with a sub selector addon. It allow to select anything within a node from a regular selector string. It is useful to get things returned in specific orders. The selector works like this. $('li(div.beginning, div.ending)'); This will return only the div.beginning and div.ending nodes under a li. The difference between this and $('li div.beginning, li div.ending') is that they will be return in their 'natural order'. Say we have this.
<ul>
<li>
<div class="beginning"></div>
<div></div>
<div class="ending"></div>
</li>
<li>
<div class="beginning"></div>
<div></div>
<div class="ending"></div>
</li>
</ul><br clear="all">
The original ascendant descendant would return a collection of (div.beginning,div.beginning,div.ending,div.ending), the new sub selector would return div.beginning,div.ending,div.beginning,div.ending. This may or may not be useful outside some special cases, but the addon is quick simple (2 mods to the selector engine), as the note on my blog states this was more as a exersice in selectors than anything else. The patch and blog entry about it <a href="http://morglog.alleycatracing.com/wordpress/?p=36">here</a>. Enjoy.
--
<a href="http://morglog.alleycatracing.com">http://morglog.alleycatracing.com</a>
Lets make up more accronyms!
<a href="http://www.alleycatracing.com">http://www.alleycatracing.com</a>
LTABOTIIOFR! ROFL! ROFL! ROFL!
Upcoming alley cats, reviews, touring logs, and a general congregation of bike nerdity.