Skip to content

Commit

Permalink
Fix document types in document adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebmaster committed Mar 5, 2016
1 parent 7f18c07 commit e8c5051
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/jsdom/browser/documentAdapter.js
@@ -1,7 +1,6 @@
"use strict";

const attributes = require("../living/attributes");
const DocumentType = require("../living/generated/DocumentType");
const idlUtils = require("../living/generated/utils");

module.exports = function (document, fragment) {
Expand Down Expand Up @@ -50,11 +49,15 @@ module.exports = function (document, fragment) {
};

exports.setDocumentType = function (doc, name, publicId, systemId) {
name = name || "";
publicId = publicId || "";
systemId = systemId || "";

const doctypeNode = doc.doctype;
if (doctypeNode) {
doctypeNode.parentNode.removeChild(doctypeNode);
}
const newType = DocumentType.createImpl([], { core: document.defaultView, ownerDocument: doc, name, publicId, systemId });
const newType = document.implementation.createDocumentType(name, publicId, systemId);
exports.appendChild(doc, newType);
};

Expand Down

0 comments on commit e8c5051

Please sign in to comment.