Class CrossWindow
Index
Methods
Methods
StaticgetActiveElement
Convenience method to retrieve the
document.activeElementvalue in the current Window context of a DOM Node / Element, EventTarget, Document, or Window.Parameters
- target: GetTarget
DOM Node / Element, EventTarget, Document, UIEvent or Window to query.
Optionaloptions: GetOptionsOptions.
Returns Element
Active element or
undefinedwhenthrowsoption isfalseand the target is invalid.- target: GetTarget
StaticgetDocument
Convenience method to retrieve the
Documentvalue in the current context of a DOM Node / Element, EventTarget, Document, UIEvent, or Window.Parameters
- target: GetTarget
DOM Node / Element, EventTarget, Document, UIEvent or Window to query.
Optionaloptions: { throws?: boolean }Options.
Returns Document
Active document or
undefinedwhenthrowsoption isfalseand the target is invalid.- target: GetTarget
StaticgetWindow
Convenience method to retrieve the
Windowvalue in the current context of a DOM Node / Element, EventTarget, Document, or Window.Parameters
- target: GetTarget
DOM Node / Element, EventTarget, Document, UIEvent or Window to query.
Optionaloptions: { throws?: boolean }Options.
Returns Window
Active window or
undefinedwhenthrowsoption isfalseand the target is invalid.- target: GetTarget
StaticisActiveElement
Convenience method to test if the given target element is the current active element.
Parameters
- target: Element
Element to test as current active element.
Returns boolean
- target: Element
StaticisCSSImportRule
Provides basic prototype string type checking if
targetis a CSSImportRule.Parameters
- target: unknown
A potential CSSImportRule to test.
Returns target is CSSImportRule
Is
targeta CSSImportRule.- target: unknown
StaticisCSSLayerBlockRule
Provides basic prototype string type checking if
targetis a CSSLayerBlockRule.Parameters
- target: unknown
A potential CSSLayerBlockRule to test.
Returns target is CSSLayerBlockRule
Is
targeta CSSLayerBlockRule.- target: unknown
StaticisCSSStyleRule
Provides basic prototype string type checking if
targetis a CSSStyleRule.Parameters
- target: unknown
A potential CSSStyleRule to test.
Returns target is CSSStyleRule
Is
targeta CSSStyleRule.- target: unknown
StaticisCSSStyleSheet
Provides basic prototype string type checking if
targetis a CSSStyleSheet.Parameters
- target: unknown
A potential CSSStyleSheet to test.
Returns target is CSSStyleSheet
Is
targeta CSSStyleSheet.- target: unknown
StaticisCtorName
Provides basic type checking by constructor name(s) for objects. This can be useful when checking multiple constructor names against a provided Set.
Parameters
- target: unknown
Object to test for constructor name.
- types: string | Set<string>
Specific constructor name or Set of constructor names to match.
Returns boolean
Does the provided object constructor name match the types provided.
- target: unknown
StaticisDocument
Provides basic prototype string type checking if
targetis a Document.Parameters
- target: unknown
A potential Document to test.
Returns target is Document
Is
targeta Document.- target: unknown
StaticisDocumentFragment
Provides precise type checking if
targetis a DocumentFragment.Parameters
- target: unknown
A potential DocumentFragment to test.
Returns target is DocumentFragment
Is
targeta DocumentFragment.- target: unknown
StaticisDOMException
Provides basic duck type checking and error name for DOMException.
Parameters
- target: unknown
Error to duck type test.
- name: string
Specific error name.
Returns boolean
Is target a DOMException matching the error name.
- target: unknown
StaticisElement
Provides precise type checking if
targetis an Element.Parameters
- target: unknown
A potential Element to test.
Returns target is Element
Is
targetan Element.- target: unknown
StaticisEvent
Provides basic duck type checking for
Eventsignature and optional constructor name(s).Parameters
- target: unknown
A potential DOM event to test.
Optionaltypes: string | Set<string>Specific constructor name or Set of constructor names to match.
Returns target is Event
Is
targetan Event with optional constructor name check.- target: unknown
StaticisFocusableHTMLElement
Ensures that the given target is an
instanceofall known DOM elements that are focusable. Please note that additional checks are required regarding focusable state; use A11yHelper.isFocusable for a complete check.Parameters
- target: unknown
Target to test for
instanceoffocusable HTML element.
Returns boolean
Is target an
instanceofa focusable DOM element.- target: unknown
StaticisHTMLAnchorElement
Provides precise type checking if
targetis a HTMLAnchorElement.Parameters
- target: unknown
A potential HTMLAnchorElement to test.
Returns target is HTMLAnchorElement
Is
targeta HTMLAnchorElement.- target: unknown
StaticisHTMLElement
Provides precise type checking if
targetis an HTMLElement.Parameters
- target: unknown
A potential HTMLElement to test.
Returns target is HTMLElement
Is
targeta HTMLElement.- target: unknown
StaticisMap
Provides basic prototype string type checking if
targetis a Map.Parameters
- target: unknown
A potential Map to test.
Returns target is Map<unknown, unknown>
Is
targeta Map.- target: unknown
StaticisNode
Provides precise type checking if
targetis a Node.Parameters
- target: unknown
A potential Node to test.
Returns target is Node
Is
targeta DOM Node.- target: unknown
StaticisPointerEvent
Provides basic duck type checking for
Eventsignature for standard mouse / pointer events includingMouseEventandPointerEvent.Parameters
- target: unknown
A potential DOM event to test.
Returns target is PointerEvent
Is
targeta MouseEvent or PointerEvent.- target: unknown
StaticisPromise
Provides basic prototype string type checking if
targetis a Promise.Parameters
- target: unknown
A potential Promise to test.
Returns target is Promise<unknown>
Is
targeta Promise.- target: unknown
StaticisRegExp
Provides basic prototype string type checking if
targetis a RegExp.Parameters
- target: unknown
A potential RegExp to test.
Returns target is RegExp
Is
targeta RegExp.- target: unknown
StaticisSet
Provides basic prototype string type checking if
targetis a Set.Parameters
- target: unknown
A potential Set to test.
Returns target is Set<unknown>
Is
targeta Set.- target: unknown
StaticisShadowRoot
Provides precise type checking if
targetis a ShadowRoot.Parameters
- target: unknown
A potential ShadowRoot to test.
Returns target is ShadowRoot
Is
targeta ShadowRoot.- target: unknown
StaticisSVGElement
Provides precise type checking if
targetis a SVGElement.Parameters
- target: unknown
A potential SVGElement to test.
Returns target is SVGElement
Is
targeta SVGElement.- target: unknown
StaticisUIEvent
Provides basic duck type checking for
Eventsignature for all UI events.Parameters
- target: unknown
A potential DOM event to test.
Returns target is UIEvent
Is
targeta UIEvent.- target: unknown
StaticisURL
Provides basic prototype string type checking if
targetis a URL.Parameters
- target: unknown
A potential URL to test.
Returns target is URL
Is
targeta URL.- target: unknown
StaticisUserInputEvent
Provides basic duck type checking for
Eventsignature for standard user input events includingKeyboardEvent,MouseEvent, andPointerEvent.Parameters
- target: unknown
A potential DOM event to test.
Returns target is MouseEvent | PointerEvent | KeyboardEvent
Is
targeta Keyboard, MouseEvent, or PointerEvent.- target: unknown
StaticisWindow
Provides basic prototype string type checking if
targetis a Window.Parameters
- target: unknown
A potential Window to test.
Returns target is Window
Is
targeta Window.- target: unknown
Provides cross-realm checks for DOM nodes / elements, events, and essential duck typing for any class-based object with a constructor name. The impetus is that certain browsers such as Chrome and Firefox behave differently when performing
instanceofchecks when elements are moved between browser windows. With Firefox in particular, the entire JS runtime cannot useinstanceofchecks as the instances of fundamental DOM elements differ between windows.TRL supports moving applications from a main central browser window and popping them out into separate standalone app instances in a separate browser window. In this case, for essential DOM element and event checks, it is necessary to employ the workarounds found in
CrossWindow.