happy-dom
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -24,2 +24,4 @@ "use strict"; | ||
var MutationType_1 = __importDefault(require("../../../mutation-observer/MutationType")); | ||
var CLONE_REFERENCE_PROPERTIES = ['ownerDocument', 'tagName', 'nodeType']; | ||
var CLONE_OBJECT_ASSIGN_PROPERTIES = ['_attributesMap', 'style']; | ||
/** | ||
@@ -234,8 +236,2 @@ * Node | ||
} | ||
else if (key !== 'parentNode' && key !== 'ownerDocument' && this[key] instanceof Node) { | ||
if (deep) { | ||
clone[key] = this[key].cloneNode(); | ||
clone[key].parentNode = clone; | ||
} | ||
} | ||
else if (key === 'classList') { | ||
@@ -245,6 +241,6 @@ // eslint-disable-next-line | ||
} | ||
else if (key === '_attributesMap') { | ||
else if (CLONE_OBJECT_ASSIGN_PROPERTIES.includes(key)) { | ||
clone[key] = Object.assign({}, this[key]); | ||
} | ||
else { | ||
else if (CLONE_REFERENCE_PROPERTIES.includes(key)) { | ||
clone[key] = this[key]; | ||
@@ -251,0 +247,0 @@ } |
{ | ||
"name": "happy-dom", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/capricorn86/happy-dom#readme", |
@@ -221,4 +221,5 @@ # Happy DOM | ||
| ------- | ---------- | ---------------- | | ||
| 0.8.0 | 2019-11-21 | Adds support for previousElementSibling and nextElementSibling. (#18) | ||
| 0.7.0 | 2019-11-21 | Thanks to [@AdeAttwood](https://github.com/AdeAttwood) we now have support for requestAnimationFrame() and cancelAnimationFrame(). (#9) | ||
| 0.8.3 | 2019-11-22 | Fixes bug with cloneNode() also copying non-node properties. | | ||
| 0.8.0 | 2019-11-22 | Adds support for previousElementSibling and nextElementSibling. (#18) | | ||
| 0.7.0 | 2019-11-21 | Thanks to [@AdeAttwood](https://github.com/AdeAttwood) we now have support for requestAnimationFrame() and cancelAnimationFrame(). (#9) | | ||
| 0.6.0 | 2019-10-28 | Thanks to [@mat3e](https://github.com/mat3e) we now have support for hasAttributes(). The "attributes" property has also been changed. It is now returning an object instead of array. (#13) | | ||
@@ -225,0 +226,0 @@ | 0.5.0 | 2019-10-21 | Adds support for click(), focus() and blur(). (#8) | |
@@ -10,2 +10,5 @@ import NodeType from './NodeType'; | ||
const CLONE_REFERENCE_PROPERTIES = ['ownerDocument', 'tagName', 'nodeType']; | ||
const CLONE_OBJECT_ASSIGN_PROPERTIES = ['_attributesMap', 'style']; | ||
/** | ||
@@ -197,2 +200,3 @@ * Node | ||
const clone = new (<typeof Node>this.constructor)(); | ||
for (const key of Object.keys(this)) { | ||
@@ -208,13 +212,8 @@ if (key !== '_isConnected' && key !== '_observers') { | ||
} | ||
} else if (key !== 'parentNode' && key !== 'ownerDocument' && this[key] instanceof Node) { | ||
if (deep) { | ||
clone[key] = this[key].cloneNode(); | ||
clone[key].parentNode = clone; | ||
} | ||
} else if (key === 'classList') { | ||
// eslint-disable-next-line | ||
clone[key] = new ClassList(<any>clone); | ||
} else if (key === '_attributesMap') { | ||
} else if (CLONE_OBJECT_ASSIGN_PROPERTIES.includes(key)) { | ||
clone[key] = Object.assign({}, this[key]); | ||
} else { | ||
} else if(CLONE_REFERENCE_PROPERTIES.includes(key)) { | ||
clone[key] = this[key]; | ||
@@ -221,0 +220,0 @@ } |
Sorry, the diff of this file is not supported yet
266
476333
12167