| 1 | <?xml version="1.0" encoding="UTF-8"?>
|
|---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
|---|
| 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|---|
| 4 |
|
|---|
| 5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|---|
| 6 | <head>
|
|---|
| 7 | <title>jQuery Speed Test</title>
|
|---|
| 8 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
|---|
| 9 | <script type="text/javascript" charset="utf-8">
|
|---|
| 10 | $(document).ready(function() {
|
|---|
| 11 | var field, parent;
|
|---|
| 12 |
|
|---|
| 13 | console.profile('parents');
|
|---|
| 14 | for (i=0; i<1000; i++) {
|
|---|
| 15 | field = $('form').find('input:visible');
|
|---|
| 16 | parent = field.parents('.form-required:first');
|
|---|
| 17 | }
|
|---|
| 18 | console.profileEnd()
|
|---|
| 19 |
|
|---|
| 20 | console.profile('closest');
|
|---|
| 21 | for (i=0; i<1000; i++) {
|
|---|
| 22 | field = $('form').find('input:visible');
|
|---|
| 23 | parent = field.closest('.form-required');
|
|---|
| 24 | }
|
|---|
| 25 | console.profileEnd()
|
|---|
| 26 | });
|
|---|
| 27 | </script>
|
|---|
| 28 | </head>
|
|---|
| 29 | <body>
|
|---|
| 30 | <form method="post" action="">
|
|---|
| 31 | <div class="form-field form-required">
|
|---|
| 32 | <label for="cat_name">Category Name</label>
|
|---|
| 33 | <input type="text" aria-required="true" size="40" value="" id="cat_name" name="cat_name"/>
|
|---|
| 34 | <p>The name is used to identify the category almost everywhere, for example under the post or in the category widget.</p>
|
|---|
| 35 | </div>
|
|---|
| 36 | </form>
|
|---|
| 37 | </body>
|
|---|
| 38 | </html>
|
|---|