git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Found a better detect for deleting an expando, added back in removeAttribute as it...
[jquery.git]
/
src
/
manipulation.js
diff --git
a/src/manipulation.js
b/src/manipulation.js
index
6f0373d
..
196f230
100644
(file)
--- a/
src/manipulation.js
+++ b/
src/manipulation.js
@@
-4,8
+4,8
@@
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
- rhtml = /<|&\w+;/,
- rnocache = /<script|<object|<embed/i,
+ rhtml = /<|&#?\w+;/,
+ rnocache = /<script|<object|<embed|<option|<style/i,
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
fcloseTag = function( all, front, tag ) {
return rselfClosing.test( tag ) ?
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
fcloseTag = function( all, front, tag ) {
return rselfClosing.test( tag ) ?
@@
-45,7
+45,7
@@
jQuery.fn.extend({
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
- return jQuery.getText( this );
+ return jQuery.text( this );
},
wrapAll: function( html ) {
},
wrapAll: function( html ) {
@@
-197,7
+197,7
@@
jQuery.fn.extend({
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML, ownerDocument = this.ownerDocument;
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML, ownerDocument = this.ownerDocument;
- if ( !html || jQuery.nodeName( this, "form" ) ) {
+ if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
@@
-300,7
+300,7
@@
jQuery.fn.extend({
},
domManip: function( args, table, callback ) {
},
domManip: function( args, table, callback ) {
- var results, first, value = args[0], scripts = [], fragment;
+ var results, first, value = args[0], scripts = [], fragment, parent;
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
@@
-318,9
+318,12
@@
jQuery.fn.extend({
}
if ( this[0] ) {
}
if ( this[0] ) {
+ parent = value && value.parentNode;
+
// If we're in a fragment, just use that instead of building a new one
// If we're in a fragment, just use that instead of building a new one
- if ( args[0] && args[0].parentNode && args[0].parentNode.nodeType === 11 ) {
- results = { fragment: args[0].parentNode };
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
+ results = { fragment: parent };
+
} else {
results = buildFragment( args, this, scripts );
}
} else {
results = buildFragment( args, this, scripts );
}
@@
-429,9
+432,10
@@
jQuery.each({
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
- var ret = [], insert = jQuery( selector );
+ var ret = [], insert = jQuery( selector ),
+ parent = this.length === 1 && this[0].parentNode;
- if ( this.length === 1 && this[0].parentNode && this[0].parentNode.nodeType === 11 && insert.length === 1 ) {
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
insert[ original ]( this[0] );
return this;
@@
-543,7
+547,9
@@
jQuery.extend({
},
cleanData: function( elems ) {
},
cleanData: function( elems ) {
- var data, id, cache = jQuery.cache;
+ var data, id, cache = jQuery.cache,
+ special = jQuery.event.special,
+ deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
id = elem[ jQuery.expando ];
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
id = elem[ jQuery.expando ];
@@
-552,12
+558,22
@@
jQuery.extend({
data = cache[ id ];
if ( data.events ) {
data = cache[ id ];
if ( data.events ) {
- for ( var event in data.events ) {
- removeEvent( elem, event, data.handle );
+ for ( var type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ } else {
+ removeEvent( elem, type, data.handle );
+ }
}
}
}
}
- removeExpando( elem );
+ if ( deleteExpando ) {
+ delete elem[ jQuery.expando ];
+
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ }
delete cache[ id ];
}
delete cache[ id ];
}