better-ajaxify
better-ajaxify copied to clipboard
Possibility to update HTML partly
If you want to have some elements untouched like <audio>
elements (to preserve playing a radio stream for example) it should be possible to update HTML partly.
Currently it's hard to do this by using the ajaxify:render
event and preventing the default because that event is using some variables like lastDomState
and domStates
which are used to update the browser history/address bar.
Maybe introducing a new event ajaxify:update
which only updates body and title is a better approach.
This way we can simply replace the default behaviour and update only the HTML parts we want.
@dtrunk90 is it an option to create audio in JavaScript, so this way DOM updates shouldn't break it.
But wouldn't that require an audio element in the DOM? That would break it again.
@dtrunk90 you don't always need to add audio element to the DOM. Just call play()
in a user action event handler.
I've made a simple demo https://jsbin.com/mumizojixo/1/edit?html,js,output
Try to play audio and then clear document body.