File: CSS.html

package info (click to toggle)
thunderbird 1%3A68.10.0-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,754,812 kB
  • sloc: cpp: 5,411,679; javascript: 4,161,772; ansic: 2,639,702; python: 763,064; java: 346,606; xml: 266,623; asm: 265,884; sh: 117,270; lisp: 41,340; makefile: 23,560; perl: 18,042; objc: 5,277; yacc: 1,778; ada: 1,681; pascal: 1,673; lex: 1,417; cs: 879; exp: 527; awk: 495; php: 436; ruby: 221; sed: 69; csh: 27
file content (48 lines) | stat: -rw-r--r-- 4,281 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!doctype html>
<meta charset="utf-8">
<title>CSSOM - CSS interface</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#the-css.escape()-method">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
    test(function () {
        // https://drafts.csswg.org/cssom/#dom-css-escape
        // https://drafts.csswg.org/cssom/#serialize-an-identifier
        assert_equals(CSS.escape("hello world"), "hello\\ world", "CSS.escape: spaces get escaped with backslashes");
        assert_equals(CSS.escape("hello\0world"), "hello\u{FFFD}world", "CSS.escape: NULL get replaced with U+FFFD REPLACEMENT CHARACTER");
        assert_equals(CSS.escape("hello0world"), "hello0world", "CSS.escape: Numbers within string preserved");
        assert_equals(CSS.escape("hello\x10world"), "hello\\10 world", "CSS.escape: Values between \\x01 and \\x1f are unicode escaped");
        assert_equals(CSS.escape("hello\\world"), "hello\\\\world", "CSS.escape: Backslashes get backslash-escaped");
        assert_equals(CSS.escape("hello\u{1234}world"), "hello\u{1234}world", "CSS.escape: Code points greater than U+0080 are preserved");
        assert_equals(CSS.escape("hello\x7Fworld"), "hello\\7f world", "CSS.escape: Some code points less than U+0080 are unicode-escaped");
        assert_equals(CSS.escape("-"), "\\-", "CSS.escape: Single dash escaped");
        assert_equals(CSS.escape("0foo"), "\\30 foo", "CSS.escape: Numbers at the beginning of an ident get unicode escaped");
        assert_equals(CSS.escape("-0foo"), "-\\30 foo", "CSS.escape: Numbers at the beginning of an ident after single hyphen get unicode escaped");
        assert_equals(CSS.escape("--0foo"), "--0foo", "CSS.escape: Numbers at the beginning of an ident after multiple hyphens do not get unicode escaped");
    }, "CSS.escape");
    test(function () {
        // https://drafts.csswg.org/css-conditional/#dom-css-supports
        // https://drafts.csswg.org/css-conditional/#typedef-supports-condition
        assert_equals(CSS.supports("color: red"), true, "CSS.supports: Single-argument form allows for declarations without enclosing parentheses");
        assert_equals(CSS.supports("(color: red) and (color: blue)"), true, "CSS.supports: Complex conditions allowed");
        assert_equals(CSS.supports("not (foobar)"), true, "CSS.supports: general_enclosed still parses");
        assert_equals(CSS.supports("color: something-pointless var(--foo)"), true, "Variable references always parse");
        assert_equals(CSS.supports("color: something-pointless(var(--foo))"), true, "Variable references in an unknown function always parse");
    }, "CSS.supports, one argument form");
    test(function () {
        // https://drafts.csswg.org/css-conditional/#dom-css-supports
        // https://drafts.csswg.org/css-conditional/#dfn-support
        assert_equals(CSS.supports("color", "red"), true, "CSS.supports: two argument form succeeds for known property");
        assert_equals(CSS.supports("unknownproperty", "blah"), false, "CSS.supports: two argument form fails for unknown property");
        assert_equals(CSS.supports("width", "blah"), false, "CSS.supports: two argument form fails for invalid value");
        assert_equals(CSS.supports("--foo", "blah"), true, "CSS.supports: two argument form succeeds for custom property");
    }, "CSS.supports, two argument form");
    test(function () {
        assert_equals(CSS.supports("selector(div)"), true, "CSS.supports: selector() function accepts a selector");
        assert_equals(CSS.supports("selector(div, div)"), false, "CSS.supports: selector() function doesn't accept a selector list");
        assert_equals(CSS.supports("selector(::-webkit-unknown-pseudo-element)"), false, "CSS.supports: selector() function rejects unknown webkit pseudo-elements.");
        assert_equals(CSS.supports("selector(::before)"), true, "CSS.supports: selector() function accepts known pseudo-elements");
        assert_equals(CSS.supports("selector(div + .c)"), true, "CSS.supports: selector() with simple combinators");
        assert_equals(CSS.supports("selector(div | .c)"), false, "CSS.supports: selector() with unknown combinators");
    }, "CSS.supports, selector function");
</script>