- var tmp = document.createElement('iframe');
- document.body.appendChild( tmp );
- var doc = tmp.contentDocument;
- doc.open();
- doc.write("<html><body><input type='text'/></body></html>");
- doc.close();
-
- var input = doc.getElementsByTagName("input")[0];
-
- input.addEventListener('click', function() {
- ok( true, "Event handling via DOM 2 methods" );
- }, false);
-
- $(input).bind("click",function() {
- ok( true, "Event handling via jQuery's handler" );
- });
-
- triggerEvent( input, "click" );
-
- document.body.removeChild( tmp );
-
+ var tmp = document.createElement('iframe');
+ document.body.appendChild( tmp );
+ var doc = tmp.contentWindow.document;
+ doc.open();
+ doc.write("<html><body><input type='text'/></body></html>");
+ doc.close();
+
+ var input = doc.getElementsByTagName("input")[0];
+
+ $(input).bind("click",function() {
+ ok( true, "Binding to element inside iframe" );
+ });
+
+ triggerEvent( input, "click" );
+
+ document.body.removeChild( tmp );
+