Skip to content

Commit 1099958

Browse files
Fix parameter order in CSSStyleDeclaration (#12)
* fix parameter order * Add changelog entry Co-authored-by: JordanMartinez <jordanalex.martinez@protonmail.com>
1 parent 0e48e3d commit 1099958

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Notable changes to this project are documented in this file. The format is based
66

77
Breaking changes:
88
- Migrate FFI to ES modules (#14 by @JordanMartinez)
9+
- Update `CSSStyleDeclaration` functions to take `style` arg last (#12 by @theqp)
10+
11+
This follows the convention of "the thing being operated on" occurs
12+
last in function that take multiple arguments.
913

1014
New features:
1115

src/Web/CSSOM/CSSStyleDeclaration.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export function cssText(style) {
44
};
55
}
66

7-
export function setCssText(style) {
8-
return function (newCSS) {
7+
export function setCssText (newCSS) {
8+
return function (style) {
99
return function () {
1010
style.cssText = newCSS;
1111
};
@@ -18,33 +18,33 @@ export function length(style) {
1818
};
1919
}
2020

21-
export function getPropertyPriority(style) {
22-
return function (propName) {
21+
export function getPropertyPriority(propName) {
22+
return function (style) {
2323
return function () {
2424
return style.getPropertyPriority(propName);
2525
};
2626
};
2727
}
2828

29-
export function getPropertyValue(style) {
30-
return function (propName) {
29+
export function getPropertyValue(propName) {
30+
return function (style) {
3131
return function () {
3232
return style.getPropertyValue(propName);
3333
};
3434
};
3535
}
3636

37-
export function removeProperty(style) {
38-
return function (propName) {
37+
export function removeProperty(propName) {
38+
return function (style) {
3939
return function () {
4040
style.removeProperty(propName);
4141
};
4242
};
4343
}
4444

45-
export function setProperty(style) {
46-
return function (propName) {
47-
return function (propValue) {
45+
export function setProperty(propName) {
46+
return function (propValue) {
47+
return function (style) {
4848
return function () {
4949
style.setProperty(propName, propValue);
5050
};

src/Web/CSSOM/CSSStyleDeclaration.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import Web.CSSOM.Internal.Types (CSSStyleDeclaration) as Exports
1313
import Web.CSSOM.Internal.Types (CSSStyleDeclaration)
1414

1515
foreign import cssText :: CSSStyleDeclaration -> Effect String
16-
foreign import setCssText :: CSSStyleDeclaration -> String -> Effect Unit
16+
foreign import setCssText :: String -> CSSStyleDeclaration -> Effect Unit
1717
foreign import length :: CSSStyleDeclaration -> Effect Number
1818

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
19+
foreign import getPropertyPriority :: String -> CSSStyleDeclaration -> Effect String
20+
foreign import getPropertyValue :: String -> CSSStyleDeclaration -> Effect String
21+
foreign import removeProperty :: String -> CSSStyleDeclaration -> Effect Unit
22+
foreign import setProperty :: String -> String -> CSSStyleDeclaration -> Effect Unit

0 commit comments

Comments
 (0)