Fire JS after element is added/attached

Currently, it’s not possible to define an event handler on an element which will fire when the element is attached/added to the DOM.

<div id="data" onattach="this.innerText = someConfig.something.data"></div>

Is there another way to have this work without using an external script:

function setData() {
    document.getElementById("data").innerText = someConfig.something.data;
}

If not, are there any plans in upcoming JS/ES spec for this sort of feature? I was not able to find anything.