forked from WebKit/WebKit-http
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalignment-parsing-utils.js
48 lines (42 loc) · 1.82 KB
/
alignment-parsing-utils.js
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
function checkValues(element, property, propertyID, value, computedValue)
{
window.element = element;
var elementID = element.id || "element";
shouldBeEqualToString("element.style." + property, value);
shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPropertyValue('" + propertyID + "')", computedValue);
}
function checkBadValues(element, property, propertyID, value)
{
var elementID = element.id || "element";
var initialValue = eval("window.getComputedStyle(" + elementID + " , '').getPropertyValue('" + propertyID + "')");
element.style[property] = value;
checkValues(element, property, propertyID, "", initialValue);
}
function checkInitialValues(element, property, propertyID, value, initial)
{
element.style[property] = value;
checkValues(element, property, propertyID, value, value);
element.style[property] = "initial";
checkValues(element, property, propertyID, "initial", initial);
}
function checkInheritValues(property, propertyID, value)
{
var parentElement = document.createElement("div");
document.body.appendChild(parentElement);
parentElement.style[property] = value;
checkValues(parentElement, property, propertyID, value, value);
var element = document.createElement("div");
parentElement.appendChild(element);
element.style[property] = "inherit";
checkValues(element, property, propertyID, "inherit", value);
}
function checkLegacyValues(property, propertyID, value)
{
var parentElement = document.createElement("div");
document.body.appendChild(parentElement);
parentElement.style[property] = value;
checkValues(parentElement, property, propertyID, value, value);
var element = document.createElement("div");
parentElement.appendChild(element);
checkValues(element, property, propertyID, "", value);
}