diff --git a/Definitions/jquery-1.8.d.ts b/Definitions/jquery-1.8.d.ts index 720fffdc40..455f7cb549 100644 --- a/Definitions/jquery-1.8.d.ts +++ b/Definitions/jquery-1.8.d.ts @@ -74,7 +74,7 @@ interface JQueryCallback { has(callback: any): bool; lock(): any; locked(): bool; - removed(...callbacks: any[]): any; + remove(...callbacks: any[]): any; } /* @@ -134,6 +134,7 @@ interface JQueryBrowserInfo { opera:bool; msie:bool; mozilla:bool; + webkit:bool; version:string; } @@ -187,7 +188,7 @@ interface JQueryStatic { /********* CALLBACKS **********/ - Callbacks(flags: any): JQueryCallback; + Callbacks(flags?: string): JQueryCallback; /**** CORE diff --git a/Tests/jquery-tests.ts b/Tests/jquery-tests.ts index 4fd5186eb3..b7e9e6685a 100644 --- a/Tests/jquery-tests.ts +++ b/Tests/jquery-tests.ts @@ -467,6 +467,184 @@ function test_attributeSelectors() { $('input[name^="news"]').val('news here!'); } +function test_before() { + $('.inner').before('
Test
'); + $('.container').before($('h2')); + $("").before(""); + var $newdiv1 = $(''), + newdiv2 = document.createElement('div'), + existingdiv1 = document.getElementById('foo'); + $('p').first().before($newdiv1, [newdiv2, existingdiv1]); +} + +function test_bind() { + $('#foo').bind('click', function () { + alert('User clicked on "foo."'); + }); + $('#foo').bind('mouseenter mouseleave', function () { + $(this).toggleClass('entered'); + }); + $('#foo').bind({ + click: function () { }, + mouseenter: function () { } + }); + $('#foo').bind('click', function () { + alert($(this).text()); + }); + $(document).ready(function () { + $('#foo').bind('click', function (event) { + alert('The mouse cursor is at (' + + event.pageX + ', ' + event.pageY + ')'); + }); + }); + var message = 'Spoon!'; + $('#foo').bind('click', function () { + alert(message); + }); + message = 'Not in the face!'; + $('#bar').bind('click', function () { + alert(message); + }); + var message = 'Spoon!'; + $('#foo').bind('click', { msg: message }, function (event) { + alert(event.data.msg); + }); + message = 'Not in the face!'; + $('#bar').bind('click', { msg: message }, function (event) { + alert(event.data.msg); + }); + $("p").bind("click", function (event) { + var str = "( " + event.pageX + ", " + event.pageY + " )"; + $("span").text("Click happened! " + str); + }); + $("p").bind("dblclick", function () { + $("span").text("Double-click happened in " + this.nodeName); + }); + $("p").bind("mouseenter mouseleave", function (event) { + $(this).toggleClass("over"); + }); + $("p").bind("click", function () { + alert($(this).text()); + }); + function handler(event) { + alert(event.data.foo); + } + $("p").bind("click", { foo: "bar" }, handler) + $("form").bind("submit", function () { return false; }) + $("form").bind("submit", function (event) { + event.preventDefault(); + }); + $("form").bind("submit", function (event) { + event.stopPropagation(); + }); + $("p").bind("myCustomEvent", function (e, myName, myValue) { + $(this).text(myName + ", hi there!"); + $("span").stop().css("opacity", 1) + .text("myName = " + myName) + .fadeIn(30).fadeOut(1000); + }); + $("button").click(function () { + $("p").trigger("myCustomEvent", ["John"]); + }); + $("div.test").bind({ + click: function () { + $(this).addClass("active"); + }, + mouseenter: function () { + $(this).addClass("inside"); + }, + mouseleave: function () { + $(this).removeClass("inside"); + } + }); +} + +function test_blur() { + $('#target').blur(function () { + alert('Handler for .blur() called.'); + }); + $('#other').click(function () { + $('#target').blur(); + + }); + $("p").blur(); +} + +function test_browser() { + jQuery.each(jQuery.browser, function (i, val) { + $("