Skip to content
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

Feature request: attribute 'none' #340

Open
staeter opened this issue Mar 14, 2022 · 1 comment
Open

Feature request: attribute 'none' #340

staeter opened this issue Mar 14, 2022 · 1 comment

Comments

@staeter
Copy link

staeter commented Mar 14, 2022

The equivalent of Element.none but for attributes:

it would give

maybeBlur =
    if blur then
        Html.Attributes.style "filter" "blur(4px)"
            |> Element.htmlAttribute
    else
        Element.Attributes.none

view =
    Element.el
        [ ...
        , maybeBlur
        ]
        Element.none

instead of

maybeBlur =
    if blur then
        Html.Attributes.style "filter" "blur(4px)"
            |> Element.htmlAttribute
            |> List.singleton
    else
        []

view =
    Element.el
        ( [ ...
          ]
               ++ maybeBlur
        )
        Element.none
@pravdomil
Copy link

I'm using:

noneAttribute : Attribute msg
noneAttribute =
    htmlAttribute (Html.Attributes.classList [])

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

No branches or pull requests

2 participants