Extending selector engine extendibility
<div dir="ltr">I have been doing a lot of work and experimentation with the selector engine lately. One of the things I have been working on is a CSS selector. One of the problems I ran across was not being able to add new subselector types. Like attributes being matched in [attr=val] I wanted to match {cssAttr=val} but could not accomplish this with expand jQuery.parse and jQuery.expr alone. The roadblock is in jQuery.filter, after the jQuery.parse's are executed, then if m still exists, a series of if/else if' are done on m[1] and m[2], on of them being if m[1] == '['.
The following patch is a proof of concept showing a way to extend the filtering. All the if statments are moved into an annonymous function in jQuery.filters array. The annonymous function accepts m,t,r,not. The if function is inverted; if(!(orig if) and returns false if failed. Success then executes and returns the new set as r and the for-loop breaks continueing executes.
Execution times on averege where about .1ms longer, but I am sure this could be refined upon. Again, just a proof of concept for some I have need a couple times now.<br clear="all">
--
<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.
</div>