I’ve written the following small feature test.
var _delete = (function(el, prop){
try {
var div = document.createElement('div'); div._xyz = 1;
delete(div._xyz);
return function(el, prop){ delete el[prop] };
} catch(e){
return function(el,prop){ el.removeAttribute(prop) };
}
}());
I want to remove ‘div’ before returning the function. Testing in IE something like div.parentNode.removeChild(div); will fail. If I look in the dom 'div’s parentNode is null, so that explains that. It needs to be appended to something first I guess.
What’s the best way of going about this?
I guess I could append a unique Id to the body, but I’m trying to avoid that.
How about simply delete div; ?
Thanks
RLM