Introduction
The gform.tools
object is a toolkit that includes functions for tasks like debouncing events, manipulating DOM elements, handling cookies, and managing events.
Overview
Method | Parameters | Returns | Description |
---|---|---|---|
convertElements() | Selector|Node|NodeList | Array | Converts a collection or selector into a standardized array of DOM elements. |
debounce() | Function|Number|Boolean | Function | Limits the rate at which a function can fire. |
defaultFor() | Any|Any | Any | Returns a default value if the original value is null or undefined. |
delegate() | Element|String|String|Function | Undefined | Implements event delegation for handling events on child elements. |
elementToHTML() | Element | String | Converts a DOM element into its HTML string representation. |
getClosest() | Element|String | Element | Finds the closest ancestor element matching a given selector. |
getCookie() | String | String | Retrieves the value of a specified cookie. |
getFocusable() | Element | Array | Finds all focusable child elements within the specified element. |
getNodes() | Selector|Element|Any|Any | Array | Retrieves DOM nodes matching a selector within a context. |
htmlToElement() | String | Element | Converts an HTML string into a DOM element. |
isRtl() | None | Boolean | Checks if the document is in right-to-left (RTL) mode. |
mergeObjects() | None (Variable arguments) | Object | Merges multiple objects into a single object. |
removeCookie() | String | Undefined | Deletes a specified cookie. |
setAttr() | Element|Selector|String|Any|Any|Any | Undefined | Sets attributes on DOM elements. |
setCookie() | String|String|Number|String | Undefined | Sets a cookie with specified attributes (name, value, expiration, etc.). |
stripSlashes() | String | String | Removes backslashes from a string. |
trigger() | String|Element|Any|Any | Undefined | Triggers a custom or native event on an element. |
uniqueId() | String|Element | String | Generates a unique identifier for an element or context. |
visible() | Element | Boolean | Checks if an element is visible in the DOM. |