forked from reflex/reflex-framework
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCSSStyleDeclaration.as
More file actions
58 lines (49 loc) · 1.08 KB
/
CSSStyleDeclaration.as
File metadata and controls
58 lines (49 loc) · 1.08 KB
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
56
57
58
package mx.styles
{
import mx.core.mx_internal;
public class CSSStyleDeclaration
{
protected var _styles:Object = {};
protected var _selector:CSSSelector;
public function CSSStyleDeclaration(selector:CSSSelector = null)
{
if (selector) {
StyleManager.setStyleDeclaration(selector.toString(), this);
}
_selector = selector;
}
public function get selector():CSSSelector
{
return _selector;
}
public function get specificity():uint
{
return _selector.specificity;
}
public function get styles():Object
{
return _styles;
}
public function getStyle(styleProp:String):*
{
return _styles[styleProp];
}
mx_internal function setStyle(styleProp:String, value:*):void
{
_styles[styleProp] = value;
}
// always return null so that the new factory will be set
public function get factory():Function
{
return null;
}
public function set factory(value:Function):void
{
var styles:Object = {};
value.call(styles);
for (var i:String in styles) {
mx_internal::setStyle(i, styles[i]);
}
}
}
}