Tip: Click lines to highlight, hold ctrl/cmd to multi-select
http://codedumper.com/ejuno (17-Feb @ 03:11)
Syntax Highlighted Code
- $.each({
- prevOf: "previousSibling",
- nextOf: "nextSibling"
- }, function( method, traversal ) {
- $.fn[ method ] = function( selector ) {
- return this.pushStack( this.map(function() {
- var ret = this[ traversal ];
- while ( ret && !$( ret ).is( selector ) ) {
- ret = ret[ traversal ];
- }
- return ret;
- }) );
- };
- });
Plain Code
$.each({
prevOf: "previousSibling",
nextOf: "nextSibling"
}, function( method, traversal ) {
$.fn[ method ] = function( selector ) {
return this.pushStack( this.map(function() {
var ret = this[ traversal ];
while ( ret && !$( ret ).is( selector ) ) {
ret = ret[ traversal ];
}
return ret;
}) );
};
});