TextFormat: TextFormat() constructor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The TextFormat() constructor returns a new TextFormat object.

Syntax

js
new TextFormat()
new TextFormat(options)

Parameters

options Optional

An optional object with the following properties:

rangeStart

A number representing the start position of the text range that needs to be formatted.

rangeEnd

A number representing the end position of the text range that needs to be formatted.

underlineStyle

A string representing the underline style of the text range that needs to be formatted.

underlineThickness

A string representing the underline thickness of the text range that needs to be formatted.

Specifications

Specification
EditContext API
# dom-textformat-constructor

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
TextFormat() constructor
Experimental

See also