diff --git a/CHANGELOG.md b/CHANGELOG.md index 3664ba2..a320893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/src/Web/CSSOM/CSSStyleDeclaration.js b/src/Web/CSSOM/CSSStyleDeclaration.js index 8ebb322..ca6c5ac 100644 --- a/src/Web/CSSOM/CSSStyleDeclaration.js +++ b/src/Web/CSSOM/CSSStyleDeclaration.js @@ -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; }; @@ -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); }; diff --git a/src/Web/CSSOM/CSSStyleDeclaration.purs b/src/Web/CSSOM/CSSStyleDeclaration.purs index f0bd516..1052d31 100644 --- a/src/Web/CSSOM/CSSStyleDeclaration.purs +++ b/src/Web/CSSOM/CSSStyleDeclaration.purs @@ -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