gform.tools

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

MethodParametersReturnsDescription
convertElements()Selector|Node|NodeListArrayConverts a collection or selector into a standardized array of DOM elements.
debounce()Function|Number|BooleanFunctionLimits the rate at which a function can fire.
defaultFor()Any|AnyAnyReturns a default value if the original value is null or undefined.
delegate()Element|String|String|FunctionUndefinedImplements event delegation for handling events on child elements.
elementToHTML()ElementStringConverts a DOM element into its HTML string representation.
getClosest()Element|StringElementFinds the closest ancestor element matching a given selector.
getCookie()StringStringRetrieves the value of a specified cookie.
getFocusable()ElementArrayFinds all focusable child elements within the specified element.
getNodes()Selector|Element|Any|AnyArrayRetrieves DOM nodes matching a selector within a context.
htmlToElement()StringElementConverts an HTML string into a DOM element.
isRtl()NoneBooleanChecks if the document is in right-to-left (RTL) mode.
mergeObjects()None (Variable arguments)ObjectMerges multiple objects into a single object.
removeCookie()StringUndefinedDeletes a specified cookie.
setAttr()Element|Selector|String|Any|Any|AnyUndefinedSets attributes on DOM elements.
setCookie()String|String|Number|StringUndefinedSets a cookie with specified attributes (name, value, expiration, etc.).
stripSlashes()StringStringRemoves backslashes from a string.
trigger()String|Element|Any|AnyUndefinedTriggers a custom or native event on an element.
uniqueId()String|ElementStringGenerates a unique identifier for an element or context.
visible()ElementBooleanChecks if an element is visible in the DOM.