X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=325f303a8316d399a654c33f33926ee43fd34e62;hb=e1b940d74824282fd3466d39a8ab574da4ef6fc5;hp=3054eea1d3a259f756cc14e3a255f86dc4346bc2;hpb=bca576550249e9b79b1097669dff6d4ddd0d65cf;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 3054eea..325f303 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -2,18 +2,13 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagName = /<([\w:]+)/, rtbody = /"; - }, + raction = /\=([^="'>\s]+\/)>/g, wrapMap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], @@ -207,7 +202,7 @@ jQuery.fn.extend({ return jQuery.clean([html.replace(rinlinejQuery, "") // Handle the case in IE 8 where action=/test/> self-closes a tag - .replace(/\=([^="'>\s]+\/)>/g, '="$1">') + .replace(raction, '="$1">') .replace(rleadingWhitespace, "")], ownerDocument)[0]; } else { return this.cloneNode(true); @@ -235,7 +230,7 @@ jQuery.fn.extend({ (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { - value = value.replace(rxhtmlTag, fcloseTag); + value = value.replace(rxhtmlTag, "<$1>"); try { for ( var i = 0, l = this.length; i < l; i++ ) { @@ -253,10 +248,8 @@ jQuery.fn.extend({ } else if ( jQuery.isFunction( value ) ) { this.each(function(i){ - var self = jQuery(this), old = self.html(); - self.empty().append(function(){ - return value.call( this, i, old ); - }); + var self = jQuery(this); + self.html( value.call(this, i, self.html()) ); }); } else { @@ -327,7 +320,7 @@ jQuery.fn.extend({ results = { fragment: parent }; } else { - results = buildFragment( args, this, scripts ); + results = jQuery.buildFragment( args, this, scripts ); } fragment = results.fragment; @@ -392,7 +385,7 @@ function cloneCopyEvent(orig, ret) { }); } -function buildFragment( args, nodes, scripts ) { +jQuery.buildFragment = function( args, nodes, scripts ) { var fragment, cacheable, cacheresults, doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); @@ -422,7 +415,7 @@ function buildFragment( args, nodes, scripts ) { } return { fragment: fragment, cacheable: cacheable }; -} +}; jQuery.fragments = {}; @@ -479,7 +472,7 @@ jQuery.extend({ } else if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, fcloseTag); + elem = elem.replace(rxhtmlTag, "<$1>"); // Trim whitespace, otherwise indexOf won't work as expected var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), @@ -569,7 +562,7 @@ jQuery.extend({ jQuery.event.remove( elem, type ); } else { - removeEvent( elem, type, data.handle ); + jQuery.removeEvent( elem, type, data.handle ); } } }