@qualweb/qw-element
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -34,2 +34,4 @@ /// <reference types="@qualweb/types" /> | ||
getElementNextSibling(): QWElement | null; | ||
getPreviousSibling(): QWElement | string | undefined | null; | ||
getNextSibling(): QWElement | string | undefined | null; | ||
getElementParent(): QWElement | null; | ||
@@ -36,0 +38,0 @@ getParentAllContexts(): QWElement | null; |
@@ -259,2 +259,32 @@ "use strict"; | ||
} | ||
getPreviousSibling() { | ||
const sibling = this.element.previousSibling; | ||
if (sibling) { | ||
if (sibling.nodeType === 1) { | ||
return this.convertElementToQWElement(sibling); | ||
} | ||
else if (sibling.nodeType === 3) { | ||
return sibling.textContent; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
} | ||
return null; | ||
} | ||
getNextSibling() { | ||
const sibling = this.element.nextSibling; | ||
if (sibling) { | ||
if (sibling.nodeType === 1) { | ||
return this.convertElementToQWElement(sibling); | ||
} | ||
else if (sibling.nodeType === 3) { | ||
return sibling.textContent; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
} | ||
return null; | ||
} | ||
getElementParent() { | ||
@@ -261,0 +291,0 @@ return this.convertElementToQWElement(this.element.parentElement); |
{ | ||
"name": "@qualweb/qw-element", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "QualWeb element interface and utilities", | ||
@@ -37,19 +37,19 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@qualweb/types": "^0.5.15", | ||
"@qualweb/types": "^0.6.10", | ||
"@tsconfig/recommended": "^1.0.1", | ||
"@types/node": "^14.14.37", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"@types/node": "^16.3.3", | ||
"@typescript-eslint/eslint-plugin": "^4.28.3", | ||
"@typescript-eslint/parser": "^4.28.3", | ||
"chai": "^4.3.4", | ||
"eslint": "^7.24.0", | ||
"eslint-config-prettier": "^8.2.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-sonarjs": "^0.6.0", | ||
"eslint": "^7.31.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-sonarjs": "^0.9.1", | ||
"esm": "^3.2.25", | ||
"mocha": "^8.3.2", | ||
"prettier": "^2.2.1", | ||
"mocha": "^9.0.2", | ||
"prettier": "^2.3.2", | ||
"rimraf": "^3.0.2", | ||
"typedoc": "^0.20.35", | ||
"typedoc": "^0.21.4", | ||
"typescript": "^4.2.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
577
42727
7