What I tried:
var container = document.createDocumentFragment();
var headline = document.createElement('h1');
headline.innerHTML = 'This is a headline.';
container.appendChild(headline);
document.body.appendChild(container);
container.addEventListener('click', function () {
console.log(arguments);
});
This example does not work. The event does not fire.
Is it possible to associate the click event with a fragment of a document or is it simply impossible?
source
share