Skip to content

Conversation

@singpolyma
Copy link
Contributor

Both needed so one can use el.style for dynamically styling DOM Element.

Copy link
Member

@garyb garyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks great aside from one minor thing with the coercion here.


foreign import style :: ElementCSSInlineStyle -> Effect CSSStyleDeclaration

fromElement :: Element -> ElementCSSInlineStyle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fromHTMLElement and using Web.HTML.HTMLElement (HTMLElement) since the spec IDL just has:

HTMLElement implements ElementCSSInlineStyle;
SVGElement implements ElementCSSInlineStyle;

(No need to worry about the SVG case just now, there isn't a web-svg library).

Element is the parent interface so both of these, but also applies to XML documents I think, where this wouldn't apply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

This is a mixin for HTMLElement and others from CSSOM to add the style attribute.
Adds all needed methods.  There are also named properties for every CSS
property, but those are redundant with getPropertyValue / setProperty.
@garyb
Copy link
Member

garyb commented Sep 27, 2020

Thanks!

@garyb garyb merged commit ae2ff8a into purescript-web:master Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants