//>>excludeStart("exclude", pragmas.exclude); define([ "shoestring" ], function(){ //>>excludeEnd("exclude"); /** * Returns a `shoestring` object with the set of siblings of each element in the original set. * * @return shoestring * @this shoestring */ shoestring.fn.next = function(){ //>>includeStart("development", pragmas.development); if( arguments.length > 0 ){ shoestring.error( 'next-selector' ); } //>>includeEnd("development"); var result = []; // TODO need to implement map this.each(function() { var children, item, found; // get the child nodes for this member of the set children = shoestring( this.parentNode )[0].childNodes; for( var i = 0; i < children.length; i++ ){ item = children.item( i ); // found the item we needed (found) which means current item value is // the next node in the list, as long as it's viable grab it // NOTE may need to be more permissive if( found && item.nodeType === 1 ){ result.push( item ); break; } // find the current item and mark it as found if( item === this ){ found = true; } } }); return shoestring( result ); }; //>>excludeStart("exclude", pragmas.exclude); }); //>>excludeEnd("exclude");