diff --git a/www/api.md b/www/api.md index 9529663c..c51dc2d4 100644 --- a/www/api.md +++ b/www/api.md @@ -124,7 +124,7 @@ to provide custom SSE setup. // override SSE event sources to not use credentials htmx.createEventSource = function(url) { return new EventSource(url, {withCredentials:false}); - }); + }; ``` ### Property - [`htmx.createWebSocket`](#createWebSocket) @@ -141,7 +141,7 @@ to provide custom WebSocket setup. ```js // override WebSocket to use a specific protocol htmx.createWebSocket = function(url) { - return new WebSocket(url, ['wss']);; + return new WebSocket(url, ['wss']); }; ``` @@ -261,7 +261,7 @@ or htmx.off("click", myEventListener); // remove this click listener from the given div - var allParagraphsInMyDiv = htmx.off("#my-div", "click", myEventListener) + htmx.off("#my-div", "click", myEventListener) ``` ### Method - [`htmx.on()`](#on) @@ -310,6 +310,8 @@ initializing the content with a javascript library Parses an interval string consistent with the way htmx does. Useful for plugins that have timing-related attributes. +Caution: Accepts an int followed by either `s` or `ms`. All other values use `parseFloat` + ##### Parameters * `str` - timing string @@ -319,6 +321,9 @@ Parses an interval string consistent with the way htmx does. Useful for plugins ```js // returns 3000 var milliseconds = htmx.parseInterval("3s"); + + // returns 3 - Caution + var milliseconds = htmx.parseInterval("3m"); ``` ### Method - [`htmx.process()`](#process) @@ -412,7 +417,7 @@ Toggles the given class on an element ```js // toggles the selected class on tab2 - htmx.toggle(htmx.find("#tab2"), "selected"); + htmx.toggleClass(htmx.find("#tab2"), "selected"); ``` ### Method - [`htmx.trigger()`](#trigger) @@ -434,7 +439,7 @@ Triggers a given event on an element ### Method - [`htmx.values()`](#values) -Returns the intput values that would resolve for a given element via the htmx value resolution mechanism +Returns the input values that would resolve for a given element via the htmx value resolution mechanism ##### Parameters