Skip to content

Fix parameter order in CSSStyleDeclaration #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Notable changes to this project are documented in this file. The format is based

Breaking changes:
- Migrate FFI to ES modules (#14 by @JordanMartinez)
- Update `CSSStyleDeclaration` functions to take `style` arg last (#12 by @theqp)

This follows the convention of "the thing being operated on" occurs
last in function that take multiple arguments.

New features:

Expand Down
22 changes: 11 additions & 11 deletions src/Web/CSSOM/CSSStyleDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export function cssText(style) {
};
}

export function setCssText(style) {
return function (newCSS) {
export function setCssText (newCSS) {
return function (style) {
return function () {
style.cssText = newCSS;
};
Expand All @@ -18,33 +18,33 @@ export function length(style) {
};
}

export function getPropertyPriority(style) {
return function (propName) {
export function getPropertyPriority(propName) {
return function (style) {
return function () {
return style.getPropertyPriority(propName);
};
};
}

export function getPropertyValue(style) {
return function (propName) {
export function getPropertyValue(propName) {
return function (style) {
return function () {
return style.getPropertyValue(propName);
};
};
}

export function removeProperty(style) {
return function (propName) {
export function removeProperty(propName) {
return function (style) {
return function () {
style.removeProperty(propName);
};
};
}

export function setProperty(style) {
return function (propName) {
return function (propValue) {
export function setProperty(propName) {
return function (propValue) {
return function (style) {
return function () {
style.setProperty(propName, propValue);
};
Expand Down
10 changes: 5 additions & 5 deletions src/Web/CSSOM/CSSStyleDeclaration.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import Web.CSSOM.Internal.Types (CSSStyleDeclaration) as Exports
import Web.CSSOM.Internal.Types (CSSStyleDeclaration)

foreign import cssText :: CSSStyleDeclaration -> Effect String
foreign import setCssText :: CSSStyleDeclaration -> String -> Effect Unit
foreign import setCssText :: String -> CSSStyleDeclaration -> Effect Unit
foreign import length :: CSSStyleDeclaration -> Effect Number

foreign import getPropertyPriority :: CSSStyleDeclaration -> String -> Effect String
foreign import getPropertyValue :: CSSStyleDeclaration -> String -> Effect String
foreign import removeProperty :: CSSStyleDeclaration -> String -> Effect Unit
foreign import setProperty :: CSSStyleDeclaration -> String -> String -> Effect Unit
foreign import getPropertyPriority :: String -> CSSStyleDeclaration -> Effect String
foreign import getPropertyValue :: String -> CSSStyleDeclaration -> Effect String
foreign import removeProperty :: String -> CSSStyleDeclaration -> Effect Unit
foreign import setProperty :: String -> String -> CSSStyleDeclaration -> Effect Unit