summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/cssom-remove-shorthand-property.html
blob: fd1cbb8efb809cb450b4ade66cdb8ca2e23cb553 (plain)
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
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>

shorthandProperties = [
    "font",
    "border-top",
    "border-right",
    "border-bottom",
    "border-left",
    "border",
    "border-color",
    "border-style",
    "border-width",
    "background-position",
    "background-repeat",
    "border-spacing",
    "list-style",
    "margin",
    "outline",
    "padding",
    "background",
    "overflow",
    "border-radius"
];

element = document.createElement('span');

function canSetProperty(propertyName) {
    element.style.setProperty(propertyName, 'initial');
    return element.style.getPropertyValue(propertyName) == 'initial';
}

function canRemoveProperty(propertyName) {
    element.style.removeProperty(propertyName);
    return element.style.getPropertyValue(propertyName) != 'initial';
}

description("Tests that shorthand properties can be removed via CSSOM.");

for (i = 0; i < shorthandProperties.length; ++i) {
    var propertyName = shorthandProperties[i];

    shouldBe("canSetProperty('" + propertyName + "')", "true");
    shouldBe("canRemoveProperty('" + propertyName + "')", "true");
}

</script>
</body>
</html>