jQuery.fn.extend({
text: function( text ) {
+ if(jQuery.isFunction(text)) {
+ return this.each(function() {
+ return jQuery(this).text( text.call(this) );
+ });
+ }
+
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
if ( this[0] ) {
// The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone();
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
}).end();
},
-
+
append: function() {
return this.domManip(arguments, true, function(elem){
if ( this.nodeType === 1 ) {
return;
}
- var events = jQuery.data( orig[i], "events" );
-
- for ( var type in events ) {
- for ( var handler in events[ type ] ) {
- jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
- }
- }
+ jQuery.data( this, jQuery.data( orig[i++] ) );
});
}
function cleanData( elems ) {
for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
- if ( !jQuery.noData[elem.nodeNode.toLowerCase()] && (id = elem[expando]) ) {
+ if ( !jQuery.noData[elem.nodeName.toLowerCase()] && (id = elem[expando]) ) {
delete jQuery.cache[ id ];
}
}