JSPM

@wordpress/dom

2.16.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 174500
  • Score
    100M100P100Q161627F
  • License GPL-2.0-or-later

DOM utilities module for WordPress.

Package Exports

  • @wordpress/dom

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wordpress/dom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

DOM

DOM utilities module for WordPress.

Installation

Install the module

npm install @wordpress/dom --save

API

# computeCaretRect

Get the rectangle for the selection in a container.

Parameters

  • win Window: The window of the selection.

Returns

  • ?DOMRect: The rectangle.

# documentHasSelection

Check whether the current document has a selection. This checks for both focus in an input field and general text selection.

Parameters

  • doc Document: The document to check.

Returns

  • boolean: True if there is selection, false if not.

# documentHasTextSelection

Check whether the current document has selected text. This applies to ranges of text in the document, and not selection inside and