-
Notifications
You must be signed in to change notification settings - Fork 0
/
more-jquery.js
39 lines (29 loc) · 902 Bytes
/
more-jquery.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(function ( $ ) {
$.fn.moreJquery = function( options ) {
var settings = $.extend({
dontRemove : true
}, options );
var el = this;
var parent = el.parent()
var html = el.html()
var removingFunctions = [
'remove',
'replaceWith',
'detach',
'empty',
]
Object.keys($.fn).forEach(function(key){
if(typeof $.fn[key] == 'function' && key != 'moreJquery'){
if(settings.dontRemove && removingFunctions.indexOf(key)>-1)
return;
try{
$.fn[key].apply(el,options)
}
catch(err){
// console.warn("ah, sorry couldn't call " + key)
}
}
})
return this;
};
}( jQuery ));