Skip to content

Commit

Permalink
Fix #13818: Add wrapMap entry for col element
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Apr 24, 2013
1 parent 78c803f commit 3a61940
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/manipulation.js
Expand Up @@ -16,6 +16,7 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>
option: [ 1, "<select multiple='multiple'>", "</select>" ], option: [ 1, "<select multiple='multiple'>", "</select>" ],


thead: [ 1, "<table>", "</table>" ], thead: [ 1, "<table>", "</table>" ],
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],


Expand All @@ -25,7 +26,7 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>
// Support: IE 9 // Support: IE 9
wrapMap.optgroup = wrapMap.option; wrapMap.optgroup = wrapMap.option;


wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.col = wrapMap.thead; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td; wrapMap.th = wrapMap.td;


jQuery.fn.extend({ jQuery.fn.extend({
Expand Down
14 changes: 14 additions & 0 deletions test/unit/manipulation.js
Expand Up @@ -2105,3 +2105,17 @@ test( "Make sure specific elements with content created correctly (#13232)", 20,
ok( jQuery.nodeName( this, results[ i ] ) ); ok( jQuery.nodeName( this, results[ i ] ) );
}); });
}); });

test( "Validate creation of multiple quantities of certain elements (#13818)", 44, function() {
var tags = [ "thead", "tbody", "tfoot", "colgroup", "col", "caption", "tr", "th", "td", "optgroup", "option" ];

jQuery.each( tags, function( index, tag ) {
jQuery( "<" + tag + "/><" + tag + "/>" ).each(function() {
ok( jQuery.nodeName( this, tag ), tag + " empty elements created correctly" );
});

jQuery( "<" + this + "></" + tag + "><" + tag + "></" + tag + ">" ).each(function() {
ok( jQuery.nodeName( this, tag ), tag + " elements with closing tag created correctly" );
});
});
});

0 comments on commit 3a61940

Please sign in to comment.