Skip to content

Commit a594363

Browse files
committed
Add ElemmentCSSInlineStyle
This is a mixin for HTMLElement and others from CSSOM to add the style attribute.
1 parent 9550957 commit a594363

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strict";
2+
3+
exports.style = function(el) {
4+
return function() {
5+
return el.style;
6+
};
7+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module Web.CSSOM.ElementCSSInlineStyle
2+
( module Exports
3+
, style
4+
, fromHTMLElement
5+
) where
6+
7+
import Effect (Effect)
8+
import Unsafe.Coerce (unsafeCoerce)
9+
import Web.CSSOM.Internal.Types (ElementCSSInlineStyle) as Exports
10+
import Web.CSSOM.Internal.Types (ElementCSSInlineStyle, CSSStyleDeclaration)
11+
import Web.HTML.HTMLElement (HTMLElement)
12+
13+
foreign import style :: ElementCSSInlineStyle -> Effect CSSStyleDeclaration
14+
15+
fromHTMLElement :: HTMLElement -> ElementCSSInlineStyle
16+
fromHTMLElement = unsafeCoerce

src/Web/CSSOM/Internal/Types.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module Web.CSSOM.Internal.Types where
22

3+
foreign import data CSSStyleDeclaration :: Type
34
foreign import data CSSStyleSheet :: Type
5+
foreign import data ElementCSSInlineStyle :: Type
46
foreign import data StyleSheetList :: Type

0 commit comments

Comments
 (0)