UNPKG

jquery-migrate

Version:

Migrate older jQuery code to jQuery 3.0+

56 lines (47 loc) 1.38 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jQuery Migrate event props iframe test</title> <!-- Load a jQuery and jquery-migrate plugin file based on URL --> <script src="testinit.js"></script> <script> TestManager.loadProject( "jquery", "git" ); </script> <script src="iframeTest.js"></script> <script> jQuery.noConflict(); TestManager.loadProject( "jquery-migrate", "dev", true ); </script> <script> function dispatchEvent( elem, type ) { var e = document.createEvent( "HTMLEvents" ); e.initEvent( type, true, true ); elem.dispatchEvent( e ); } function runTest() { var test1, test2, div = document.createElement( "div" ), $div = jQuery( div ).appendTo( document.body ); $div.on( "blend", function( event ) { test1 = ( "whip" in event ) && ( "chop" in event ); // Props added later are also processed jQuery.event.props.push( "frappe" ); dispatchEvent( div, "puree" ); } ); $div.on( "puree", function( event ) { test2 = ( "whip" in event ) && ( "frappe" in event ); // 2 prop warnings ( chop+whip and frappe ) startIframeTest( test1, test2 ); } ); // Multiple props, processed with a single warning jQuery.event.props.push( "chop", "whip" ); dispatchEvent( div, "blend" ); } jQuery( runTest ); </script> </head> <body> <p>jQuery Migrate</p> </body> </html>