ठीक है! सबसे पहले यह सवाल एक ऐसे व्यक्ति से आता है जो jQuery ब्रह्मांड में बहुत गहरा खो देता है (और सकारात्मक रूप से खो जाता है)।मूल्य, प्रोटोटाइप और संपत्ति का अंतर
मेरी reserch में मुझे पता चला jQuery के मुख्य पैटर्न कुछ इस तरह (जरूरत सुधार wellcomed जाता है तो) है:
(function (window, undefined) {
jQuery = function (arg) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init(arg);
},
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function (selector, context, rootjQuery) {
// get the selected DOM el.
// and returns an array
},
method: function() {
doSomeThing();
return this;
},
method2: function() {
doSomeThing();
return this;,
method3: function() {
doSomeThing();
return this;
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
//defines the extend method
};
// extends the jQuery function and adds some static methods
jQuery.extend({
method: function() {}
})
})
$
jQuery.prototype.init
शुरू शुरू की और तत्वों की एक सरणी देता है। लेकिन मुझे समझ में नहीं आया कि यह jQuery विधि जैसे .css
या .hide
इत्यादि को कैसे जोड़ता है। इस सरणी के लिए।
मुझे स्थिर तरीके मिलते हैं। लेकिन यह उन सभी विधियों के साथ तत्वों की वापसी और सरणी कैसे प्राप्त नहीं हो सका।
@adnan thanx – Lupus