mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Manipulation: simplify html wrappers
Take advantage of html serialization for html wrappers - saves 26 bytes
Plus add additional test for "col" element
(cherry-picked from 0ea342a6a6
)
Closes gh-2031
Fixes gh-2002
This commit is contained in:
parent
3e8712062d
commit
b744a50d47
@ -52,9 +52,20 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
|
||||
param: [ 1, "<object>", "</object>" ],
|
||||
|
||||
thead: [ 1, "<table>", "</table>" ],
|
||||
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
||||
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
|
||||
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
||||
|
||||
// Some of the following wrappers are not fully defined, because
|
||||
// their parent elements (except for "table" element) could be omitted
|
||||
// since browser parsers are smart enough to auto-insert them
|
||||
|
||||
// Support: Android 2.3
|
||||
// Android browser doesn't auto-insert colgroup
|
||||
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
|
||||
|
||||
// Auto-insert "tbody" element
|
||||
tr: [ 2, "<table>", "</table>" ],
|
||||
|
||||
// Auto-insert "tbody" and "tr" elements
|
||||
td: [ 3, "<table>", "</table>" ],
|
||||
|
||||
// IE8 can't serialize link, script, style, or any html5 (NoScope) tags,
|
||||
// unless wrapped in a div with non-breaking characters in front of it.
|
||||
|
@ -2485,6 +2485,18 @@ test( "Make sure jQuery.fn.remove can work on elements in documentFragment", 1,
|
||||
equal( fragment.childNodes.length, 0, "div element was removed from documentFragment" );
|
||||
});
|
||||
|
||||
test( "Make sure col element is appended correctly", function() {
|
||||
expect( 1 );
|
||||
|
||||
var table = jQuery( "<table cellpadding='0'><tr><td style='padding:0'>test</td></tr></table>" );
|
||||
|
||||
jQuery( table ).appendTo( "#qunit-fixture" );
|
||||
|
||||
jQuery( "<col width='150'/>" ).prependTo( table );
|
||||
|
||||
strictEqual( table.find( "td" ).width(), 150 );
|
||||
});
|
||||
|
||||
asyncTest( "Insert script with data-URI (gh-1887)", 1, function() {
|
||||
Globals.register( "testFoo" );
|
||||
Globals.register( "testSrcFoo" );
|
||||
@ -2509,4 +2521,3 @@ asyncTest( "Insert script with data-URI (gh-1887)", 1, function() {
|
||||
start();
|
||||
}, 100 );
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user