git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'bug_7413' of https://github.com/rwldrn/jquery into rwldrn-bug_7413
[jquery.git]
/
src
/
manipulation.js
diff --git
a/src/manipulation.js
b/src/manipulation.js
index
325f303
..
e09dd7e
100644
(file)
--- a/
src/manipulation.js
+++ b/
src/manipulation.js
@@
-7,8
+7,11
@@
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
+ // checked="checked" or checked (html5)
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
raction = /\=([^="'>\s]+\/)>/g,
raction = /\=([^="'>\s]+\/)>/g,
+ rbodystart = /^\s*<body/i,
+ rbodyend = /<\/body>\s*$/i,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
@@
-33,7
+36,8
@@
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
- var self = jQuery(this);
+ var self = jQuery( this );
+
self.text( text.call(this, i, self.text()) );
});
}
self.text( text.call(this, i, self.text()) );
});
}
@@
-82,7
+86,8
@@
jQuery.fn.extend({
}
return this.each(function() {
}
return this.each(function() {
- var self = jQuery( this ), contents = self.contents();
+ var self = jQuery( this ),
+ contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
if ( contents.length ) {
contents.wrapAll( html );
@@
-193,11
+198,14
@@
jQuery.fn.extend({
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
- var html = this.outerHTML, ownerDocument = this.ownerDocument;
+ var html = this.outerHTML,
+ ownerDocument = this.ownerDocument;
if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
+ } else if ( rbodystart.test(html) && rbodyend.test(html) ) {
+ html = html.replace( rbodystart, "<div>" ).replace( rbodyend, "</div>" );
}
return jQuery.clean([html.replace(rinlinejQuery, "")
}
return jQuery.clean([html.replace(rinlinejQuery, "")
@@
-248,7
+256,8
@@
jQuery.fn.extend({
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
- var self = jQuery(this);
+ var self = jQuery( this );
+
self.html( value.call(this, i, self.html()) );
});
self.html( value.call(this, i, self.html()) );
});
@@
-271,13
+280,14
@@
jQuery.fn.extend({
}
if ( typeof value !== "string" ) {
}
if ( typeof value !== "string" ) {
- value = jQuery(value).detach();
+ value = jQuery( value ).detach();
}
return this.each(function() {
}
return this.each(function() {
- var next = this.nextSibling, parent = this.parentNode;
+ var next = this.nextSibling,
+ parent = this.parentNode;
- jQuery(this).remove();
+ jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
if ( next ) {
jQuery(next).before( value );
@@
-295,7
+305,9
@@
jQuery.fn.extend({
},
domManip: function( args, table, callback ) {
},
domManip: function( args, table, callback ) {
- var results, first, value = args[0], scripts = [], fragment, parent;
+ var results, first, fragment, parent,
+ value = args[0],
+ scripts = [];
// 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 ) ) {
@@
-370,7
+382,9
@@
function cloneCopyEvent(orig, ret) {
return;
}
return;
}
- var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
+ var oldData = jQuery.data( orig[i++] ),
+ curData = jQuery.data( this, oldData ),
+ events = oldData && oldData.events;
if ( events ) {
delete curData.handle;
if ( events ) {
delete curData.handle;
@@
-427,7
+441,8
@@
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 ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {