JuliaWeb / Hyperscript.jl

Hyperscript: A lightweight DOM representation for Julia
Other
101 stars 11 forks source link

Adding attributes without values #16

Closed kskyten closed 5 years ago

kskyten commented 5 years ago

How do I add, for example, a controls attribute to a video tag?

<video controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>
yurivish commented 5 years ago

Hi,

You can use nothing as the value to create a valueless attribute:

julia> m("video", controls=nothing)
<video controls></video>

Note that right now I recommend using the master branch of Hyperscript; now that it's got more users I plan to do a release some time in the near future with all of the latest improvements.

kskyten commented 5 years ago

Thanks!