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
What I'm currently do is this, and it works just fine:
udm.safari = (
udm.xdom = (
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..