Merge pull request #1708 from johnnyreilly/master

jQuery: JSDoc'd blur and bind
This commit is contained in:
John Reilly
2014-02-20 21:30:04 +00:00
4 changed files with 50 additions and 5 deletions
+1 -1
View File
@@ -568,7 +568,7 @@ function test_bind() {
$("form").bind("submit", function (event) {
event.stopPropagation();
});
$("p").bind("myCustomEvent", function (e, myName, myValue) {
$("p").bind("myCustomEvent", function (e, myName?, myValue?) {
$(this).text(myName + ", hi there!");
$("span").stop().css("opacity", 1)
.text("myName = " + myName)
+47 -2
View File
@@ -2028,14 +2028,59 @@ interface JQuery {
*/
toggle(showOrHide: boolean): JQuery;
// Events
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
*/
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param eventData An object containing data that will be passed to the event handler.
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
*/
bind(eventType: string, eventData: any, preventBubble: boolean): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
*/
bind(eventType: string, preventBubble: boolean): JQuery;
bind(...events: any[]): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param events An object containing one or more DOM event types and functions to execute for them.
*/
bind(events: any): JQuery;
/**
* Trigger the "blur" event on an element
*/
blur(): JQuery;
/**
* Bind an event handler to the "blur" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "blur" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
+1 -1
View File
@@ -71,7 +71,7 @@ function test_pagesDialogs() {
}
});
$(document).bind("pagebeforechange", function (e, data) {
$(document).bind("pagebeforechange", function (e, data?) {
if (typeof data.toPage === "string") {
var u = $.mobile.path.parseUrl(data.toPage),
re = /^#category-item/;
+1 -1
View File
@@ -422,7 +422,7 @@ function test_misc() {
});
store = new Sammy.Store({ name: 'kvo' });
$('body').bind('set-kvo-foo', function (e, data) {
$('body').bind('set-kvo-foo', function (e, data?) {
Sammy.log(data.key + ' changed to ' + data.value);
});
store.set('foo', 'bar');