Skip to content

Commit

Permalink
Fix mockDom for DocumentFragment, revert to better ownerDocument impl…
Browse files Browse the repository at this point in the history
…ementation
  • Loading branch information
KoryNunn committed Jul 22, 2024
1 parent 7c92788 commit e0a0540
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 2 additions & 5 deletions render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ var df = require("../render/domFor")
var delayedRemoval = df.delayedRemoval
var domFor = df.domFor

module.exports = function($window) {
var $doc = $window && $window.document
module.exports = function() {
var nameSpace = {
svg: "http://www.w3.org/2000/svg",
math: "http://www.w3.org/1998/Math/MathML"
Expand All @@ -16,7 +15,7 @@ module.exports = function($window) {
var currentRender

function getDocument(dom) {
return dom.ownerDocument || $doc;
return dom.ownerDocument;
}

function getNameSpace(vnode) {
Expand Down Expand Up @@ -919,8 +918,6 @@ module.exports = function($window) {
var currentDOM

return function(dom, vnodes, redraw) {
$doc = dom.ownerDocument;

if (!dom) throw new TypeError("DOM element being rendered to does not exist.")
if (currentDOM != null && dom.contains(currentDOM)) {
throw new TypeError("Node is currently being rendered to and thus is locked.")
Expand Down
1 change: 1 addition & 0 deletions test-utils/domMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ module.exports = function(options) {
},
createDocumentFragment: function() {
return {
ownerDocument: $window.document,
nodeType: 11,
nodeName: "#document-fragment",
appendChild: appendChild,
Expand Down

0 comments on commit e0a0540

Please sign in to comment.