Yeah that's essentially what I'm doing now, but to save code in disparate places where one or the other method is needed, I wanted to set a global flag that means it understands both document.styleSheets
and createElementNS
What I'm currently do is this, and it works just fine:
Code:
udm.safari = (
navigator.vendor!='KDE'&&
typeof document.childNodes!="undefined"&&
typeof document.all=="undefined"&&
typeof navigator.taintEnabled=="undefined"
)?true:false;
udm.xdom = (
typeof document.createElementNS!='undefined'&&
typeof document.styleSheets!="undefined"&&
!udm.safari
)?true:false;
But it's not 100% reliable - because the Safari test is a hack that may not always work - and it doesn't allow for the possibility of future browsers which may, like Safari, declare support for both but not actually have a useable implementation.
So I was thinking, if I *know* a document is in the XML DOM, it's near-as-dammit safe to assume it can support these methods.
But thanks guys for your answers.

I wouldn't mind knowing academically how to detect the DOM, but I guess it's not essential to know..