samedi 25 avril 2015

using “jQuery.event.special”


i am new to Jquery and basically i have been try to look up the bootstrap transition.js(line 50) code and figure out how it works in there . i have stumbled across a really big hurdle . the line of code thats got me stumped is the following :

$.event.special.bsTransitionEnd = {
      bindType: $.support.transition.end,
      delegateType: $.support.transition.end,
      handle: function (e) {
        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
      }

now i did read the documentation here. but really could't understand much except the following :

 bindType: // the event you want to bind with 
 delegateType: // the event you want to delegate with

now i did ask this question on multiple forum and got alot of vague answers such . "This is't a beginner question" and "you'll probably have to look up the Jquery source" . and another answer mentioned the following :

Those are the special attributes for the transition end event that are made available for later use in transition.js. But I SILL DON'T GET IT .

I am trying to figure out things by reading this article , but all i want to know is .... what is $.event.special , WHAT is the use of this line ? WHAT is its common usage ?

P.S. :: I did read this Question on SO but it has more external links than the answer itself , also i am asking a basic question here as to WHAT is the use of $.event.special ? And WHAT are common use cases of $.event.special ?

I am Hoping there is some genius who can answer this question. i went around asking this question so many times that i even got told :

99% of jQuery users have never and will never write this kind of code.

SO now I am really really curious !

Thank you.

Alexander.


Aucun commentaire:

Enregistrer un commentaire