bennadel.com
Submitted by: David Walsh

jQuery Plugin: Tracing Your Selector Paths

A while back, I wrote a proof-of-concept about enabling step-debugging in your jQuery selector paths. In that previous demo, you had to enter your jQuery selector values into a form and execute it manually within the test environment. This morning, I took that same concept and rolled it into a jQuery plugin. The plugin both lives as a utility function off of the jQuery library as well as a function that extends the jQuery collections which, internally, just calls the utility method. The way the tracer works is that it starts at the top of the selector path and walks through each selector step, adding a CSS class to each set of resultant nodes, giving them each a successively darker background color.

direct link