happy-dom
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -57,2 +57,14 @@ import NodeType from './NodeType'; | ||
/** | ||
* Previous element sibling. | ||
* | ||
* @return {Node} Node. | ||
*/ | ||
readonly previousElementSibling: Node; | ||
/** | ||
* Next element sibling. | ||
* | ||
* @return {Node} Node. | ||
*/ | ||
readonly nextElementSibling: Node; | ||
/** | ||
* First child. | ||
@@ -59,0 +71,0 @@ * |
@@ -141,2 +141,34 @@ "use strict"; | ||
}); | ||
Object.defineProperty(Node.prototype, "previousElementSibling", { | ||
/** | ||
* Previous element sibling. | ||
* | ||
* @return {Node} Node. | ||
*/ | ||
get: function () { | ||
var previousSibling = this.previousSibling; | ||
while (previousSibling !== null && previousSibling.nodeType !== NodeType_1.default.ELEMENT_NODE) { | ||
previousSibling = this.previousSibling; | ||
} | ||
return previousSibling; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Node.prototype, "nextElementSibling", { | ||
/** | ||
* Next element sibling. | ||
* | ||
* @return {Node} Node. | ||
*/ | ||
get: function () { | ||
var nextSibling = this.nextSibling; | ||
while (nextSibling !== null && nextSibling.nodeType !== NodeType_1.default.ELEMENT_NODE) { | ||
nextSibling = this.nextSibling; | ||
} | ||
return nextSibling; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Node.prototype, "firstChild", { | ||
@@ -143,0 +175,0 @@ /** |
{ | ||
"name": "happy-dom", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/capricorn86/happy-dom#readme", |
@@ -221,2 +221,3 @@ # 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). | ||
@@ -223,0 +224,0 @@ | 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). |
@@ -120,2 +120,28 @@ import NodeType from './NodeType'; | ||
/** | ||
* Previous element sibling. | ||
* | ||
* @return {Node} Node. | ||
*/ | ||
public get previousElementSibling(): Node { | ||
let previousSibling = this.previousSibling; | ||
while(previousSibling !== null && previousSibling.nodeType !== NodeType.ELEMENT_NODE) { | ||
previousSibling = this.previousSibling; | ||
} | ||
return previousSibling; | ||
} | ||
/** | ||
* Next element sibling. | ||
* | ||
* @return {Node} Node. | ||
*/ | ||
public get nextElementSibling(): Node { | ||
let nextSibling = this.nextSibling; | ||
while(nextSibling !== null && nextSibling.nodeType !== NodeType.ELEMENT_NODE) { | ||
nextSibling = this.nextSibling; | ||
} | ||
return nextSibling; | ||
} | ||
/** | ||
* First child. | ||
@@ -122,0 +148,0 @@ * |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
476543
12174
265