#4617 closed feature (duplicate)
xml() function, or addition to html() function
Reported by: | yuniti | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.5 |
Component: | core | Version: | 1.3.2 |
Keywords: | xml, innerXml | Cc: | |
Blocked by: | Blocking: |
Description
Not sure what the preference would be - the advantage of making an xml() function would be that it is more sensical and would not allow a parameter, whereas html() would be consistent. In any case, below are both functions. xml() has been tested, html() was simply modified using the xml() code.
html: function( value ) {
var node = this[0]; return value === undefined ?
(node ?
(node.innerHTML ?
node.innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
(node.xml (new XMLSerializer()).serializeToString(node) "") .replace(new RegExp("(<
w*" + node.tagName + "[>]*>)|(<
w*
/
w*" + node.tagName + "[>]*>$)", "gi"), "")) :null) :
this.empty().append( value );
},
xml : function()
{
var node = this[0],
tagName = node.tagName;
if ( ! tagName )
return this.html();
return (node.xml (new XMLSerializer()).serializeToString(node) "").replace( new RegExp("(<
w*" + tagName + "[>]*>)|(<
w*
/
w*" + tagName + "[>]*>$)", "gi"), "");}
Change History (5)
comment:1 Changed 13 years ago by
Component: | unfiled → core |
---|
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Milestone: | 1.4 → 1.5 |
---|---|
Priority: | major → low |
Status: | new → open |
Jakibo had some good notes on this one on the dupe ticket:
https://github.com/jablko/jquery/commit/2fea569dce44e5f6df8d67fef277db4599d4aab2 http://groups.google.com/group/jquery-dev/browse_thread/thread/594106bdd4dc7375?pli=1 http://www.sfu.ca/~jdbates/tmp/jquery/201004090/patch
Dmethvin asked for a less magical approach though, so merging up minds for this one could help.
comment:4 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
#5022 is a duplicate of this ticket.