- It won't trigger initial
onload for elements that are in DOM already:
import onload from "fast-on-load";
onload(document.body, () => console.log('on'), () => console.log('off'))
// silence in console
- It triggers
unload-only for elements present in both added/removed nodes:
let a = document.createElement(a)
onload(a, function () {
console.log('on')
}, function () {
console.log('off')
})
document.body.appendChild(a)
document.body.removeChild(a)
// logs only 'off'
Just to make sure if that's planned behavior.
onloadfor elements that are in DOM already:unload-only for elements present in both added/removed nodes:Just to make sure if that's planned behavior.