Brandon Aaron schrieb:
> But I bet your markup is not going to stay the same. This is just
> going to require some interesting logic that will take lots of time to
> parse. You'll have to climb the tree and if not a P, then check its
> children and repeat.
>   
You could start with nextUntil() and rewrite it:

jQuery.fn.nextUntil = function(expr) {
    var match = [];

    // We need to figure out which elements to push onto the array
    this.each(function(){
        // Traverse through the sibling nodes
        for( var i = this.nextSibling; i; i = i.nextSibling ) {
            // Make sure that we're only dealing with elements
            if ( i.nodeType != 1 ) continue;

            // If we find a match then we need to stop
            if ( jQuery.filter( expr, [i] ).r.length ) break;

            // Otherwise, add it on to the stack
            match.push( i );
        }
    });

    return this.pushStack( match, arguments );
}; 

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to