1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
3 | <head> |
---|
4 | <title>wrapInner fails on empty elements</title> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
6 | |
---|
7 | <script type="text/javascript" src="http://code.jquery.com/nightlies/jquery-nightly.js"></script> |
---|
8 | <script type="text/javascript"> |
---|
9 | |
---|
10 | function wrapInner(selector) |
---|
11 | { |
---|
12 | $(selector).wrapInner("<div></div>"); |
---|
13 | }; |
---|
14 | |
---|
15 | </script> |
---|
16 | |
---|
17 | <style type="text/css"> |
---|
18 | div { border:1px solid black; margin: 10px; min-height: 1em; } |
---|
19 | body > div { width: 8em; min-height: 4em; } |
---|
20 | </style> |
---|
21 | </head> |
---|
22 | |
---|
23 | <body> |
---|
24 | #case 1 |
---|
25 | <div id="case1"> |
---|
26 | <div>inner div 1</div> |
---|
27 | <div>inner div 2</div> |
---|
28 | </div> |
---|
29 | |
---|
30 | <input type="button" onclick='wrapInner("#case1")' value='$("#case1").wrapInner("<div></div>")' /> |
---|
31 | <br /> |
---|
32 | <br /> |
---|
33 | |
---|
34 | #case 2 (empty) |
---|
35 | <div id="case2"></div> |
---|
36 | |
---|
37 | <input type="button" onclick='wrapInner("#case2")' value='$("#case2").wrapInner("<div></div>")' /> |
---|
38 | <br /> |
---|
39 | <br /> |
---|
40 | |
---|
41 | #case 3 (contains a space [" "]) |
---|
42 | <div id="case3"> </div> |
---|
43 | |
---|
44 | <input type="button" onclick='wrapInner("#case3")' value='$("#case3").wrapInner("<div></div>")' /> |
---|
45 | <br /> |
---|
46 | <br /> |
---|
47 | |
---|
48 | |
---|
49 | </body> |
---|
50 | </html> |
---|