| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>Dialog Visual Test - Modal Dialog in Large DOM</title> |
| 6 | <link rel="stylesheet" href="../../../themes/base/all.css"> |
| 7 | <script src="../../../external/requirejs/require.js"></script> |
| 8 | <script src="../../../demos/bootstrap.js"> |
| 9 | var start, |
| 10 | html = new Array( 500 ).join( String.prototype.trim.call( $( "#template" ).html() ) ); |
| 11 | $( html ).appendTo( "body" ); |
| 12 | |
| 13 | start = new Date(); |
| 14 | $( "#dialog" ).dialog({ |
| 15 | modal: true, |
| 16 | autoOpen: false |
| 17 | }); |
| 18 | $( "<li>Create: " + (new Date() - start) + "ms</li>" ).appendTo( "#log" ); |
| 19 | |
| 20 | $( "#opener" ).on( "click", function() { |
| 21 | start = new Date(); |
| 22 | $( "#dialog" ).dialog( "open" ); |
| 23 | $( "<li>Open: " + (new Date() - start) + "ms</li>" ).appendTo( "#log" ); |
| 24 | }); |
| 25 | </script> |
| 26 | </head> |
| 27 | <body> |
| 28 | |
| 29 | <p>WHAT: A single dialog is created on a page with a large DOM.</p> |
| 30 | <p>EXPECTED: Creating and opening the dialog should be fast, regardless of page size.</p> |
| 31 | |
| 32 | <button id="opener">open dialog</button> |
| 33 | <div id="dialog" title="Dialog Title"> |
| 34 | <p> Dialog Content </p> |
| 35 | <input type="text"> |
| 36 | </div> |
| 37 | |
| 38 | <ul id="log"></ul> |
| 39 | |
| 40 | <script type="text/html" id="template"> |
| 41 | <div><div><div><div><div><div><div><div><div><div> |
| 42 | <div><div><div><div><div><div><div><div><div><div> |
| 43 | <div><div><div><div><div><div><div><div><div><div> |
| 44 | <div><div><div><div><div><div><div><div><div><div> |
| 45 | <div><div><div><div><div><div><div><div><div><div> |
| 46 | <div><p>This <span>is</span> <span>a</span> <strong>large</strong> <abbr>DOM</abbr>.</p></div> |
| 47 | <input> |
| 48 | <select> |
| 49 | <option>option 1</option> |
| 50 | <option>option 2</option> |
| 51 | <option>option 3</option> |
| 52 | <option>option 4</option> |
| 53 | <option>option 5</option> |
| 54 | </select> |
| 55 | </div></div></div></div></div></div></div></div></div></div> |
| 56 | </div></div></div></div></div></div></div></div></div></div> |
| 57 | </div></div></div></div></div></div></div></div></div></div> |
| 58 | </div></div></div></div></div></div></div></div></div></div> |
| 59 | </div></div></div></div></div></div></div></div></div></div> |
| 60 | </script> |
| 61 | |
| 62 | </body> |
| 63 | </html> |