Testcase for jQuery Ticket 7633

attr("onclick", "fn()") not working in chrome but why should it anyway

by jitter

HTML

<button id="b1" onclick="alert('Click 1')"> Click me 1 </button>
<button id="b2" onclick="clickPlain(2)"> Click me 2 </button>
<button id="b3" onclick=clickPlain()> Click me 3 </button>
<button id="b4"> Click me 4 </button>
<button id="b5"> Click me 5 </button>
<button id="b6"> Click me 6 </button>
<button id="b7"> Click me 7 </button>

JavaScript

function clickPlain( val ) {
    if( val === undefined ) val = 3; //handle button 3
    alert( "Click " + val );
}

function clicked() {
    alert( "Clicked " + this.id );
}

function wrapper() {
    return clicked;
}
$(function() {
    $( "#b4" ).attr( "onclick", "clickPlain(4)" ); //the only which doesn't work in Chrome
    $( "#b5" ).attr( "onclick", wrapper);
    $( "#b6" ).bind( "click", clicked);
    $( "#b7" )[0].setAttribute( "onclick", "clickPlain(7)" ); // this isn't the same as $(..).attr("onclick", ..)
});