utilsWindow

Utilities for the window context. DOM, rendering, visual effects, user input, etc.

Source:

Methods

(static) cleanUpPasteDom(element, containerElement) → {object}

Source:

Clean up the contents of an element created based on the HTML code of a paste.

Parameters:
Name Type Description
element Element
containerElement Element
Returns:
Type
object

(static) getElementFromPasteHtml(html) → {Element}

Source:

Turn HTML code of a paste into an element.

Parameters:
Name Type Description
html string
Returns:
Type
Element

(static) getExtendedRect(el) → {object}

Source:

Get the bounding client rectangle of an element, setting values that include margins to the outerTop, outerBottom, outerLeft, and outerRight properties. The margins are cached.

Parameters:
Name Type Description
el Element
Returns:
Type
object

(static) getFooter() → {external:jQuery}

Source:

Get the footer element.

Returns:
Type
external:jQuery

(static) getHigherNodeAndOffsetInSelection(selection) → {object}

Source:

Given a selection, get a node and offset that are higher in the document, regardless if they belong to an anchor node or focus node.

Parameters:
Name Type Description
selection Selection
Returns:
Type
object

(static) getRangeContents(start, end, rootElement) → (nullable) {Array.<Element>}

Source:

Get all nodes between the two specified, including them. This works equally well if they are at different nesting levels. Descendants of nodes that are already included are not included.

Parameters:
Name Type Description
start Element
end Element
rootElement Element
Returns:
Type
Array.<Element>

(static) getVisibilityByRects(…rects) → {boolean}

Source:

Given bounding client rectangle(s), determine whether the element is visible.

Parameters:
Name Type Attributes Description
rects object <repeatable>
Returns:

true if visible, false if not.

Type
boolean

(static) isCmdModifierPressed(e) → {boolean}

Source:

Whether a command modifier is pressed. On Mac, this means the Cmd key. On Windows, this means the Ctrl key.

Parameters:
Name Type Description
e Event
Returns:
Type
boolean

(static) isElementConvertibleToWikitext(element) → {boolean}

Source:

Check whether there is something in the element that can be converted to wikitext.

Parameters:
Name Type Description
element Element
Returns:
Type
boolean

(static) isHtmlConvertibleToWikitext(html, containerElement) → {boolean}

Source:

Check whether there is something in the HTML that can be converted to wikitext.

Parameters:
Name Type Description
html string
containerElement Element
Returns:
Type
boolean

(static) isInputFocused() → {boolean}

Source:

Check if an input or editable element is focused.

Returns:
Type
boolean

(static) keyCombination(e, keyCode, modifiersopt) → {boolean}

Source:

Check if the provided key combination is pressed given an event.

Parameters:
Name Type Attributes Default Description
e Event
keyCode number
modifiers Array.<('cmd'|'shift'|'alt'|'meta')> <optional>
[]

Use 'cmd' instead of 'ctrl'.

Returns:
Type
boolean

(static) skin$(selectors) → {external:jQuery}

Source:

Get elements using the right selector for the current skin given an object with skin names as keys and selectors as values. If no value for the skin is provided, the default value is used.

Parameters:
Name Type Description
selectors object
Returns:
Type
external:jQuery

(static) transparentize(color) → {string}

Source:

Generate a transparent color for the given color to use it in a gradient.

Parameters:
Name Type Description
color string
Returns:
Type
string

(static) wrapDiffBody(body) → {string}

Source:

Wrap the response to the "compare" API request in a table.

Parameters:
Name Type Description
body string
Returns:
Type
string

(static) wrapHtml(html, optionsopt) → {external:jQuery}

Source:

Wrap a HTML string into a <span> (or other element) suitable as an argument for various methods. It fills the same role as OO.ui.HtmlSnippet, but works not only with OOUI widgets. Optionally, attach callback functions and target="_blank" attribute to links with the provided class names. See also jQuery.cdMerge.

Parameters:
Name Type Attributes Default Description
html string
options object <optional>
{}
Properties
Name Type Attributes Default Description
callbacks module:utilsWindow~WrapCallbacks <optional>
tagName string <optional>
'span'
targetBlank boolean <optional>
Returns:
Type
external:jQuery

Type Definitions

WrapCallbacks

Source:
Properties:
Name Type Description
* function
Type:
  • object