for (i = 0; i < $('body > p font i').length; i++) {
current = [$('body > p font i').eq(index), $('body > p font i').eq(index).index('body > p font u, body > p font i')];
getState(current[1]);
}
function getState(index) {
// Lookup the object index, then crawl up until you find a match
while ($('body > p font u, body > p font i').eq(--index).filter('u').length == 0);
console.log($('body > p font u, body > p font i').eq(index).text());
}
Pretty simple question. I repeat the jQuery result set against the selector filter until I find a match, going up the result set when I go.
The longer this cycle, the slower it becomes almost exponentially.
source
share