Skip to content

Commit

Permalink
Merge pull request #542 from bcardiff/dark-reader
Browse files Browse the repository at this point in the history
Wrap style node to deal with DarkReader
  • Loading branch information
rtfeldman authored Oct 15, 2021
2 parents c60f12b + 79eb0fa commit ebb7a25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/Css/Global.elm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ global snippets =
|> VirtualDom.text
|> List.singleton
|> VirtualDom.node "style" []
-- wrap the style node in a div to prevent `Dark Reader` from blowin up the dom.
|> List.singleton
|> VirtualDom.node "span" []
|> VirtualDom.Styled.unstyledNode


Expand Down
14 changes: 9 additions & 5 deletions src/VirtualDom/Styled.elm
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,15 @@ toKeyedStyleNode allStyles keyedChildNodes =

toStyleNode : Dict Classname (List Style) -> VirtualDom.Node msg
toStyleNode styles =
-- this <style> node will be the first child of the requested one
toDeclaration styles
|> VirtualDom.text
|> List.singleton
|> VirtualDom.node "style" []
-- wrap the style node in a div to prevent `Dark Reader` from blowin up the dom.
VirtualDom.node "span"
[]
[ -- this <style> node will be the first child of the requested one
toDeclaration styles
|> VirtualDom.text
|> List.singleton
|> VirtualDom.node "style" []
]



Expand Down

0 comments on commit ebb7a25

Please sign in to comment.