From e464e2a6dc0e560acc426408bdc34bd309560eea Mon Sep 17 00:00:00 2001 From: "sayrer%gmail.com" Date: Sat, 28 Oct 2006 23:11:22 +0000 Subject: [PATCH] Make MochiKit.DOM detect it is in XUL and use createElementNS(kXHTMLNS,...) when it is --- testing/mochitest/MochiKit/DOM.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/testing/mochitest/MochiKit/DOM.js b/testing/mochitest/MochiKit/DOM.js index bd715cc0388..4767eb8d7e0 100644 --- a/testing/mochitest/MochiKit/DOM.js +++ b/testing/mochitest/MochiKit/DOM.js @@ -28,6 +28,15 @@ if (typeof(MochiKit.DOM) == 'undefined') { MochiKit.DOM = {}; } +var kXHTMLNSURI = "http://www.w3.org/1999/xhtml"; +var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; +if (document.documentElement && + document.documentElement.namespaceURI == kXULNSURI) { + MochiKit.DOM.useNS = true; +} else { + MochiKit.DOM.useNS = false; +} + MochiKit.DOM.NAME = "MochiKit.DOM"; MochiKit.DOM.VERSION = "1.4"; MochiKit.DOM.__repr__ = function () { @@ -498,7 +507,11 @@ MochiKit.Base.update(MochiKit.DOM, { name = "<" + name + contents + ">"; } } - elem = self._document.createElement(name); + if (self.useNS) { + elem = self._document.createElementNS(kXHTMLNSURI, name); + } else { + elem = self._document.createElement(name); + } } else { elem = name; }