I'm trying to use jQuery.fn.extend
to override jQuery.fn.init
with my own implementation which is going to behave differently from the original implementation but is going to need to call the original implementation at certain places to do the real work.
So, the very first thing would be to actually "proxy" for the original implementation in the new one. That's what I'm attempting to do and I'm observing what seems like awkward behaviour (this seems like one of those JS things).
You can see my latest attempt here. So the problem is. It is only supposed to apply the border to the .parent .child
. Not both .parent
and .child
. That's what it seems to be doing right now. If you remove my jQuery.fn.extend
call. You can see the original, correct behavior.
So, the question is what am I doing wrong? Is this the right approach to proxying any JS function and specially the jQuery
init
function? Is there a better way?
Extra
I saw this old question and the answer there refers to jQuery.sub which has been moved to the jQuery Migrate plugin now. Should I try to use that? Is it any more likely to work than what I'm trying right now? Do I really need to?