Skip to content
Permalink
Browse files

Add comments for optgroup and option elements in wrapMap

Add tests for optgroup element
  • Loading branch information
markelog committed Dec 28, 2012
1 parent f193acf commit d3d8ed443cedf9bba3af4fd71744cceb0ace0c93
Showing with 8 additions and 1 deletion.
  1. +3 −0 src/manipulation.js
  2. +5 −1 test/unit/manipulation.js
@@ -9,6 +9,8 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
wrapMap = {

// Support: IE 9
option: [ 1, "<select multiple='multiple'>" ],
legend: [ 1, "<fieldset>" ],
param: [ 1, "<object>" ],
@@ -19,6 +21,7 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>
_default: [ 0, "" ]
};

// Support: IE 9
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
@@ -395,7 +395,7 @@ var testAppendForObject = function( valueObj, isFragment ) {

var testAppend = function( valueObj ) {

expect( 61 );
expect( 63 );

testAppendForObject( valueObj, false );
testAppendForObject( valueObj, true );
@@ -454,6 +454,10 @@ var testAppend = function( valueObj ) {
jQuery("#select1").append( valueObj("<OPTION>Test</OPTION>") );
equal( jQuery("#select1 option:last").text(), "Test", "Appending OPTION (all caps)" );

jQuery("#select1").append( valueObj("<optgroup label='optgroup'><option>optgroup</option></optgroup>") );
equal( jQuery("#select1 optgroup").attr("label"), "optgroup", "Label attribute in newly inserted optgroup is correct" );
equal( jQuery("#select1 option:last").text(), "optgroup", "Appending optgroup" );

jQuery("#table").append( valueObj("<colgroup></colgroup>") );
equal( jQuery("#table colgroup").length, 1, "Append colgroup" );

0 comments on commit d3d8ed4

Please sign in to comment.
You can’t perform that action at this time.