Skip to content

StyleSheet

Types

cssRule

A single CSS rule. There are several types of rules, listed in the Type constants section below. See CSSRule on MDN

type cssRule = {
mutable cssText: string,
parentRule: Null.t<cssRule>,
parentStyleSheet: Null.t<cssStyleSheet>,
}

Record fields

cssText
string
parentRule
Null.t<cssRule>
parentStyleSheet

cssRuleList

A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. See CSSRuleList on MDN

type cssRuleList = private {length: int}

Record fields

cssStyleSheet

A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. See CSSStyleSheet on MDN TODO: mark as private once mutating fields of private records is allowed

type cssStyleSheet = {
type_: string,
href: Null.t<string>,
ownerNode: Null.t<unknown>,
parentStyleSheet: Null.t<cssStyleSheet>,
title: Null.t<string>,
media: WebAPI.MediaList.t,
mutable disabled: bool,
ownerRule: Null.t<cssRule>,
cssRules: cssRuleList,
}

Record fields

type_
string
href
Null.t<string>
ownerNode
Null.t<unknown>
parentStyleSheet
title
Null.t<string>
disabled
bool
ownerRule
Null.t<cssRule>

init

type init = {
mutable baseURL?: string,
mutable media?: unknown,
mutable disabled?: bool,
}

Record fields

baseURL
option<string>
media
option<unknown>
disabled
option<bool>

t

A single style sheet. CSS style sheets will further implement the more specialized CSSStyleSheet interface. See StyleSheet on MDN

type t = {
type_: string,
href: Null.t<string>,
ownerNode: Null.t<unknown>,
parentStyleSheet: Null.t<cssStyleSheet>,
title: Null.t<string>,
media: WebAPI.MediaList.t,
mutable disabled: bool,
}

Record fields

type_
string
href
Null.t<string>
ownerNode
Null.t<unknown>
parentStyleSheet
title
Null.t<string>
disabled
bool

Values

asStyleSheet

let asStyleSheet: cssStyleSheet => t

Parameters

cssStyleSheet

Return type

t

deleteRule

let deleteRule: (cssStyleSheet, int) => unit

Parameters

cssStyleSheetint

Return type

unit

insertRule

let insertRule: (cssStyleSheet, ~rule: string, ~index: int=?) => int

Parameters

cssStyleSheetstringoption<int>

Return type

int

make

let make: (~options: init=?) => cssStyleSheet

Parameters

option<init>

Return type

cssStyleSheet

replace

let replace: (cssStyleSheet, string) => promise<cssStyleSheet>

Parameters

cssStyleSheetstring

Return type

promise<cssStyleSheet>

replaceSync

let replaceSync: (cssStyleSheet, string) => unit

Parameters

cssStyleSheetstring

Return type

unit