Skip to content

Commit aa2646b

Browse files
committed
Add CSSSTyleDeclaration
Adds all needed methods. There are also named properties for every CSS property, but those are redundant with getPropertyValue / setProperty.
1 parent 8aa3a3f commit aa2646b

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

src/Web/CSSOM/CSSStyleDeclaration.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"use strict";
2+
3+
exports.cssText = function(style) {
4+
return function() {
5+
return style.cssText;
6+
};
7+
}
8+
9+
exports.setCssText = function(style) {
10+
return function(newCSS) {
11+
return function() {
12+
style.cssText = newCSS;
13+
};
14+
};
15+
}
16+
17+
exports.length = function(style) {
18+
return function() {
19+
return style.length;
20+
};
21+
}
22+
23+
exports.getPropertyPriority = function(style) {
24+
return function(propName) {
25+
return function() {
26+
return style.getPropertyPriority(propName);
27+
};
28+
};
29+
}
30+
31+
exports.getPropertyValue = function(style) {
32+
return function(propName) {
33+
return function() {
34+
return style.getPropertyValue(propName);
35+
};
36+
};
37+
};
38+
39+
exports.removeProperty = function(style) {
40+
return function(propName) {
41+
return function() {
42+
style.removeProperty(propName);
43+
};
44+
};
45+
};
46+
47+
exports.setProperty = function(style) {
48+
return function(propName) {
49+
return function(propValue) {
50+
return function() {
51+
style.setProperty(propName, propValue);
52+
};
53+
};
54+
};
55+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module Web.CSSOM.CSSStyleDeclaration
2+
( module Exports
3+
, length
4+
, getPropertyPriority
5+
, getPropertyValue
6+
, removeProperty
7+
, setProperty
8+
) where
9+
10+
import Prelude
11+
import Effect (Effect)
12+
import Web.CSSOM.Internal.Types (CSSStyleDeclaration) as Exports
13+
import Web.CSSOM.Internal.Types (CSSStyleDeclaration)
14+
15+
foreign import cssText :: CSSStyleDeclaration -> Effect String
16+
foreign import setCssText :: CSSStyleDeclaration -> String -> Effect Unit
17+
foreign import length :: CSSStyleDeclaration -> Effect Number
18+
19+
foreign import getPropertyPriority :: CSSStyleDeclaration -> String -> Effect String
20+
foreign import getPropertyValue :: CSSStyleDeclaration -> String -> Effect String
21+
foreign import removeProperty :: CSSStyleDeclaration -> String -> Effect Unit
22+
foreign import setProperty :: CSSStyleDeclaration -> String -> String -> Effect Unit

0 commit comments

Comments
 (0)