I created a custom jquery event called \'loading\' in my application. I want to append a masking element with a spinner, when this event is triggered. I can figure out tha
You can add child elements, they just won't render. This may sound like a semantic distinction, but it's critical to your problem: the DOM doesn't know whether a particular tag is rendered or not.
Your best bet is just to check manual:
var allowChildren = function(elem) {
return ! (elem.nodeName in { INPUT : true, IMG : true }) ;
};