web

Description

Common patterns for working with the WEB API.

Depends on:

Details

17

Classes


new StyleService( instanceName, config )

Methods


<static> clickElement( base, selectorArray [, matchSelf ] ) → {boolean}

Description

Run querySelector to get an element, then click it.

Parameters
Name Type Attributes Default Description
base external:Element

Where to start looking.

selectorArray Array.<string>

CSS selectors to use to find an element.

matchSelf boolean <optional>
false

If a CSS selector would match base, then use it.

Returns

Whether an element could be found.

Details

<static> focusOnElement( element [, removeNonExistent ] )

Description

Move the browser's focus onto element.

This is accomplished by ensuring the the element has a tabindex attribute. By default, if the element had no tabindex attribute, the temporary one will be removed. Some browsers will update the activeElement after removing the tabindex.

Parameters
Name Type Attributes Default Description
element external:Element

Element to focus on.

removeNonExistent boolean <optional>
true

Whether to remove the tabindex if it was originally not present.

Details

<static> focusOnTree( root )

Description

Move the browser's focus somewhere into the requested tree.

This uses a heuristic to find the first focusable element in a tree. If it is unable to find one, it falls back to forcing the requested element.

Parameters
Name Type Description
root external:Element

The root of the tree

Details

<static> postInfoAboutElement( element, area )

Description

Post a bunch of information about an Element to issues.

Parameters
Name Type Description
element external:Element

Element to get information about.

area string

What area this information came from.

Details

<static> isInput( element ) → {boolean}

Description

Determines if the element accepts keyboard input.

Parameters
Name Type Description
element external:Element

Element to examine.

Returns

Indicating whether the element accepts keyboard input.

Details

<inner> otmotMoCallback( records, observer ) → {boolean}

Description

MutationObserver callback for otmot.

Parameters
Name Type Description
records Array.<external:MutationRecord>

Standard mutation records.

observer external:MutationObserver

The invoking observer, enhanced with extra properties by otmot().

Returns

The done value of the monitor function.

Details

<static> otmot( what, how ) → {Promise.<NexusHoratio.web~Results>}

Description

One time mutation observer with timeout.

Parameters
Name Type Description
what NexusHoratio.web~OtmotWhat

What to observe.

how NexusHoratio.web~OtmotHow

How to observe.

Returns

Will resolve with the results from monitor when done is true.

Details

<inner> otrotRoCallback( entries, observer ) → {boolean}

Description

ResizeObserver callback for otrot.

Parameters
Name Type Description
entries Array.<external:ResizeObserverEntry>

Standard resize records.

observer NexusHoratio.web~ResizeObserver

The invoking observer, enhanced with extra properties by otrot().

Returns

Whether a resize was observed.

Details

<static> otrot( what, how ) → {Promise.<NexusHoratio.web~OtrotWhat>}

Description

One time resize observer with timeout.

Will resolve automatically upon first resize change.

Parameters
Name Type Description
what NexusHoratio.web~OtrotWhat

What to observe.

how OtrotHow

How to observe.

Returns

Will resolve with the what parameter.

Details

<inner> otrot2RoCallback( entries, observer )

Description

ResizeObserver callback for otrot2.

Parameters
Name Type Description
entries Array.<external:ResizeObserverEntry>

Standard resize records.

observer NexusHoratio.web~ResizeObserver

The invoking observer, enhanced with extra properties by otrot().

Details

<static> waitForSelector( selector [, timeout [, base ] ] ) → {Promise.<external:Element>}

Description

Wait for selector to match using querySelector.

Parameters
Name Type Attributes Default Description
selector string

CSS selector.

timeout number <optional>
0

Time to wait in milliseconds, 0 disables.

base external:Element <optional>
document

Where to start looking.

Returns

Matched element.

Details

Type Definitions


Results

Description

Generic object representing results.

Details
object.<string, object>

Continuation

Properties
Name Type Attributes Description
done boolean

Indicate whether the monitor is done processing.

results NexusHoratio.web~Results <optional>

Results of an observation.

Details
object

Monitor( records ) → {NexusHoratio.web~Continuation}

Parameters
Name Type Description
records Array.<external:MutationRecord>

Standard mutation records.

Returns

Indicate whether done monitoring.

Details
function

SimpleFunction()

Description

Simple function that takes no parameters and returns nothing.

Details
function

OtmotWhat

Properties
Name Type Description
name string

The name for this observer.

base external:Element

Element to observe.

Details
object

OtmotHow

Properties
Name Type Attributes Description
observeOptions object

external:MutationObserver observe() options.

trigger NexusHoratio.web~SimpleFunction <optional>

Function to call that triggers observable results.

monitor NexusHoratio.web~Monitor

Callback used to process MutationObserver records.

timeout number <optional>

Time to wait for completion in milliseconds, default of 0 disables.

Details
object

OtrotWhat

Properties
Name Type Description
name string

The name for this observer.

base external:Element

Element to observe.

Details
object

OtrotHow

Properties
Name Type Attributes Description
trigger NexusHoratio.web~SimpleFunction <optional>

Function to call that triggers observable events.

timeout number

Time to wait for completion in milliseconds.

Details
object

ResizeAction( entries )

Parameters
Name Type Description
entries Array.<external:ResizeObserverEntry>

Standard resize entries.

Details
function

Otrot2How

Properties
Name Type Attributes Description
trigger NexusHoratio.web~SimpleFunction <optional>

Function to call that triggers observable events.

action NexusHoratio.web~ResizeAction

Function to call upon each event observed and also at the end of duration.

duration number

Time to run in milliseconds.

Details
object