diff --git a/jquery.pjax/jquery.pjax-tests.ts b/jquery.pjax/jquery.pjax-tests.ts index f394e7030..d5a9e1bb1 100644 --- a/jquery.pjax/jquery.pjax-tests.ts +++ b/jquery.pjax/jquery.pjax-tests.ts @@ -29,3 +29,11 @@ function test_submit() { $.pjax.submit(event, { container: "#pjax-container" }); $.pjax.submit(event, "#pjax-container", { push: true }); } + +function test_enable() { + $.pjax.enable(); +} + +function test_disable() { + $.pjax.disable(); +} diff --git a/jquery.pjax/jquery.pjax.d.ts b/jquery.pjax/jquery.pjax.d.ts index 88118224d..f26d69443 100644 --- a/jquery.pjax/jquery.pjax.d.ts +++ b/jquery.pjax/jquery.pjax.d.ts @@ -88,7 +88,7 @@ interface PjaxStatic { * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. */ click(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void; - + /** * PJAX on form submit handler * @param event A jQuery click event. @@ -109,4 +109,15 @@ interface PjaxStatic { * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. */ submit(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void; + + /** + * Install pjax functions on $.pjax to enable pushState behavior. Does nothing if already enabled. + */ + enable(): void; + + /** + * Disable pushState behavior. + * This is the case when a browser doesn't support pushState. It is sometimes useful to disable pushState for debugging on a modern browser. + */ + disable(): void; }