Add definition and test for $.pjax function.

This commit is contained in:
Junle
2014-06-18 16:31:28 +08:00
parent 37d2280a3d
commit 2b42566cca
2 changed files with 18 additions and 0 deletions
+8
View File
@@ -8,6 +8,14 @@ function test_fn_pjax() {
$(document).pjax("a", "#pjax-container", { push: true });
}
function test_pjax() {
$.pjax();
$.pjax({
url: "hello.html",
container: "#main"
});
}
function test_click() {
var event = $.Event("click");
$.pjax.click(event, "#pjax-container");
+10
View File
@@ -58,6 +58,16 @@ interface JQueryStatic {
}
interface PjaxStatic {
/**
* Loads a URL with ajax, puts the response body inside a container, then pushState()'s the loaded URL.
* Works just like $.ajax in that it accepts a jQuery ajax settings object (with keys like url, type, data, etc).
* @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:
* - container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody).
* - push: a boolean indicates whether to pushState the URL. Default is true.
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
*/
(options?: PjaxSettings): JQueryXHR;
/**
* PJAX on click handler.
* @param event A jQuery click event.