script/dom/execcommand/commands/
stylewithcss.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use crate::dom::bindings::str::DOMString;
6use crate::dom::document::Document;
7
8/// <https://w3c.github.io/editing/docs/execCommand/#the-stylewithcss-command>
9pub(crate) fn execute_style_with_css_command(document: &Document, value: DOMString) -> bool {
10    // > If value is an ASCII case-insensitive match for the string "false", set the CSS styling flag to false.
11    // > Otherwise, set the CSS styling flag to true. Either way, return true.
12    let value = value.to_ascii_lowercase().as_str() != "false";
13
14    document.set_css_styling_flag(value);
15
16    true
17}