Already reported https://github.com/elm-lang/html/issues/124. My advice would be to use `attribute "download" "value"` and it will be removed if omitted.
On Tuesday, May 9, 2017 at 10:00:29 PM UTC+2, Kasey Speakman wrote: > > Hi, maybe someone has run into this. > > I'm noticing that download and target attributes are not getting removed > from links even though subsequent renders are omitting them. > > Using this test code on http://elm-lang.org/try: > > import Html exposing (a, text, beginnerProgram) > import Html.Events exposing (onClick) > import Html.Attributes exposing (target, download) > > main = > beginnerProgram { model = False, view = view, update = update } > > view model = > a > [ onClick Toggle > , if model then > target "_blank" > else > download True > ] > [ text "click" ] > > type Msg = > Toggle > > update msg model = > case msg of > Toggle -> > not model > > > The initial view renders download="true". > > First click renders download="null" target="_blank". In Chrome at least, > blank target is ignored and file is downloaded anyway simply for the > presence of download attribute. > > Second click renders download="true" target. > > I thought omitting the attribute would result in it being absent in the > rendered HTML, but not so. > > *Well, after I typed this out...* > > I found two work-around. > > 1) Wrap in a different parent element for each. For example, use div for > one and span for the other. > 2) Using Html.Keyed.node to put an identity on each. > > Kasey > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
