html-parser
html-parser copied to clipboard
Set video "muted" attribute as property in Parser.Util.toVirtualDom
This is a small change to allow parsed <video> elements to play in Chrome with the bundled toVirtualDom utility.
Chrome needs to set the muted attribute on <video> elements as a property in order for autoplay to work (See this thread on Elm Discourse). Note that this is only a Chrome requirement; videos will autoplay in Firefox and Safari with the current implementation.
So in short, this PR will allow the following to autoplay with Utils.toVirtualDom:
<video autoplay muted loop>
<source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4">
</video>
I was careful to apply this change only to video elements. I know the code looks a bit funky; totally open if you prefer a different style of implementation.