[CSS Grid Layout] Upgrade align-self and align-items parsing to CSS 3
[WebKit-https.git] / LayoutTests / css3 / resources / alignment-parsing-utils.js
1 function checkValues(element, property, propertyID, value, computedValue)
2 {
3     window.element = element;
4     var elementID = element.id || "element";
5     shouldBeEqualToString("element.style." + property, value);
6     shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPropertyValue('" + propertyID + "')", computedValue);
7 }
8
9 function checkBadValues(element, property, propertyID, value)
10 {
11     element.style[property] = value;
12     checkValues(element, property, propertyID, "", "start");
13 }
14
15 function checkInitialValues(element, property, propertyID, value, initial)
16 {
17     element.style[property] = value;
18     checkValues(element, property, propertyID, value, value);
19     element.style[property] = "initial";
20     checkValues(element, property, propertyID, "initial", initial);
21 }
22
23 function checkInheritValues(property, propertyID, value)
24 {
25     var parentElement = document.createElement("div");
26     document.body.appendChild(parentElement);
27     parentElement.style[property] = value;
28     checkValues(parentElement, property, propertyID, value, value);
29
30     var element = document.createElement("div");
31     parentElement.appendChild(element);
32     element.style[property] = "inherit";
33     checkValues(element, property, propertyID, "inherit", value);
34 }
35
36 function checkLegacyValues(property, propertyID, value)
37 {
38     var parentElement = document.createElement("div");
39     document.body.appendChild(parentElement);
40     parentElement.style[property] = value;
41     checkValues(parentElement, property, propertyID, value, value);
42
43     var element = document.createElement("div");
44     parentElement.appendChild(element);
45     checkValues(element, property, propertyID, "", value);
46 }