From ea434462d22dff130682ce3351b9b235ac7f4dff Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Tue, 8 Feb 2011 21:41:56 +0000 Subject: [PATCH] DocumentType.toString: Generate a valid string in all cases where the DocumentType is valid. Won't include the internal subset (yet). Also, if the full DOCTYPE string is already known, just return it immediately without all the fuss of generating one. --- lib/jsdom/level2/core.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/jsdom/level2/core.js b/lib/jsdom/level2/core.js index d0f3483312..145ebdb759 100644 --- a/lib/jsdom/level2/core.js +++ b/lib/jsdom/level2/core.js @@ -481,16 +481,28 @@ core.DocumentType.prototype.__defineGetter__("internalSubset", function() { }); core.DocumentType.prototype.toString = function() { - var dt = ' -1) { + dt += "'" + this.systemId + "'"; + } else { + dt += '"' + this.systemId + '"'; } - dt += '>'; - if (this.ownerDocument._fullDT) { - dt = this.ownerDocument._fullDT; - } - return dt; + } + dt += '>'; + return dt; }; core.Document.prototype.importNode = function(/* Node */ importedNode,