Skip to content

Commit f4839f7

Browse files
committed
Draggable Unit Tests: Ensure IFRAMEs can be written to
Draggable tests were failing in IE because the frame needs to be written to to be accessible to further DOM manipulation.
1 parent ec5f395 commit f4839f7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/unit/draggable/draggable_core.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,15 @@ test( "#9379: Draggable: position bug in scrollable div", function() {
224224
test( "#5727: draggable from iframe" , function() {
225225
expect( 1 );
226226

227-
var iframe = $( "<iframe id='iframe-draggable-container' src='about:blank'></iframe>" ).appendTo( "#qunit-fixture" ),
228-
iframeBody = iframe.contents().find( "body" ).append(
229-
"<div id='iframe-draggable-1' style='background: green; width: 200px; height: 100px;'>Relative</div>"
230-
),
231-
draggable1 = iframeBody.find( "#iframe-draggable-1" );
227+
var iframeBody, draggable1,
228+
iframe = $( "<iframe />" ).appendTo( "#qunit-fixture" ),
229+
iframeDoc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
230+
231+
iframeDoc.write( "<!doctype html><html><body>" );
232+
iframeDoc.close();
233+
234+
iframeBody = $( iframeDoc.body ).append( "<div style='width: 2px; height: 2px;' />" );
235+
draggable1 = iframeBody.find( "div" );
232236

233237
draggable1.draggable();
234238

0 commit comments

Comments
 (0)