Test case details

Preparation Code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <table data-foo="True"> <tr>   <th>Hello</th><td>World</td> </tr> </table>
function makeYellow() {        $('[data-foo]').find('td').css('background','yellow');     }         function makeYellow2($selector) {        $selector.find('td').css('background','yellow');     }

Test cases

Test #1

$(document).on('ready',makeYellow());

Test #2

$(document).ready(makeYellow());

Test #3

$(document).on('ready','[data-foo]', makeYellow());

Test #4

$(document).on('ready','[data-foo]',function() {     $(this).find('td').css('background','yellow'); });

Test #5

$(document).on('ready','[data-foo]',function() {     makeYellow2($(this)); });