Changeset 4029
- Timestamp:
- 12/05/07 00:26:13 (1 year ago)
- Location:
- trunk/jquery
- Files:
-
- 1 added
- 3 modified
-
src/core.js (modified) (2 diffs)
-
test/data/iframe.html (added)
-
test/index.html (modified) (2 diffs)
-
test/unit/core.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jquery/src/core.js
r4014 r4029 203 203 text: function( text ) { 204 204 if ( typeof text != "object" && text != null ) 205 return this.empty().append( document.createTextNode( text ) );205 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 206 206 207 207 var ret = ""; … … 469 469 470 470 if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) 471 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( document.createElement("tbody") );471 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); 472 472 473 473 var scripts = jQuery( [] ); -
trunk/jquery/test/index.html
r3959 r4029 22 22 <!-- Test HTML --> 23 23 <div id="nothiddendiv" style="height:1px;background:white;"></div> 24 <!-- this iframe is outside the #main so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves --> 25 <iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe> 24 26 <dl id="dl" style="display:none;"> 25 27 <div id="main" style="display: none;"> … … 152 154 <input type="submit" name="sub1" value="NO" /> 153 155 <input type="submit" name="sub2" value="NO" /> 154 <input type="image" name="sub3" value="NO" src="submit.gif"/>156 <input type="image" name="sub3" value="NO" /> 155 157 <button name="sub4" type="submit" value="NO">NO</button> 156 158 <input name="D1" type="text" value="NO" disabled="disabled" /> -
trunk/jquery/test/unit/core.js
r4014 r4029 552 552 var pass = true; 553 553 try { 554 $( $(" iframe")[0].contentWindow.document.body ).append("<div>test</div>");554 $( $("#iframe")[0].contentWindow.document.body ).append("<div>test</div>"); 555 555 } catch(e) { 556 556 pass = false; … … 1189 1189 1190 1190 test("contents()", function() { 1191 expect( 2);1191 expect(10); 1192 1192 equals( $("#ap").contents().length, 9, "Check element contents" ); 1193 1193 ok( $("#iframe").contents()[0], "Check existance of IFrame document" ); 1194 // Disabled, randomly fails 1195 //ok( $("#iframe").contents()[0].body, "Check existance of IFrame body" ); 1196 }); 1194 var ibody = $("#loadediframe").contents()[0].body; 1195 ok( ibody, "Check existance of IFrame body" ); 1196 1197 equals( $("span", ibody).text(), "span text", "Find span in IFrame and check its text" ); 1198 1199 $(ibody).append("<div>init text</div>"); 1200 equals( $("div", ibody).length, 2, "Check the original div and the new div are in IFrame" ); 1201 1202 equals( $("div:last", ibody).text(), "init text", "Add text to div in IFrame" ); 1203 1204 $("div:last", ibody).text("div text"); 1205 equals( $("div:last", ibody).text(), "div text", "Add text to div in IFrame" ); 1206 1207 $("div:last", ibody).remove(); 1208 equals( $("div", ibody).length, 1, "Delete the div and check only one div left in IFrame" ); 1209 1210 equals( $("div", ibody).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" ); 1211 1212 $("<table/>", ibody).append("<tr><td>cell</td></tr>").appendTo(ibody); 1213 $("table", ibody).remove(); 1214 equals( $("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" ); 1215 });
