ऐसा लगता है कि jQuery जोड़ने के बाद jQuery ट्रिम कर रहा है। नीचे दिए गए jQuery addclass कोड देखें
addClass: function(value) {
var classNames, i, l, elem,
setClass, c, cl;
if (jQuery.isFunction(value)) {
return this.each(function(j) {
jQuery(this).addClass(value.call(this, j, this.className));
});
}
if (value && typeof value === "string") {
classNames = value.split(rspace);
for (i = 0, l = this.length; i < l; i++) {
elem = this[ i ];
if (elem.nodeType === 1) {
if (!elem.className && classNames.length === 1) {
elem.className = value;
} else {
//HERE IS APPENDS ALL CLASS IT NEEDS TO ADD
setClass = " " + elem.className + " ";
for (c = 0, cl = classNames.length; c < cl; c++) {
if (!~setClass.indexOf(" " + classNames[ c ] + " ")) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim(setClass);
}
}
}
}
return this;
}
तो यह नीचे की तरह है,
jQuery.trim(" blueberry mango " + " " + "carrot")
स्रोत
2012-01-04 21:05:14
मेरा अनुमान है कि यह गति के साथ क्या करना है। क्या यह एक त्रुटि पैदा कर रहा है? – sissonb
इससे कोई त्रुटि नहीं होनी चाहिए, तो क्या इससे वाकई कोई फर्क पड़ता है? –
फिर भी यह एक दिलचस्प सवाल है। – PeeHaa