¡@

Home 

2014/10/16 ¤W¤È 12:03:29

jquery Programming Glossary: foo.prototype

What does jQuery.fn mean?

http://stackoverflow.com/questions/4083351/what-does-jquery-fn-mean

new foo arg store an argument for this example this.myArg arg .. create `fn` alias to `prototype` property foo.fn foo.prototype init function ... ... expose the library window.foo foo Extension foo.fn.myPlugin function alert this.myArg return this..

How can jQuery do method chaining? [duplicate]

http://stackoverflow.com/questions/8721569/how-can-jquery-do-method-chaining

thing as what you passed to foo . this is kinda how jQuery does it var foo function function foo elem this.elem elem foo.prototype.bar function return this.elem.id return function elem return new foo elem This is a little more complex and actually divided.. return new foo elem This is a little more complex and actually divided into two. function foo elem this.elem elem foo.prototype.bar function return this.elem.id Who doesn't love prototypical inheritance mixed with classical inheritance names Anyway...functions.. when called with the new keyword two special things happen this inside of the foo refers to a freshly made copy of foo.prototype foo.prototype is returned unless foo returns an object Note that foo.prototype isn't a magic value. It's just like any other..