happy-dom
Advanced tools
Comparing version 0.2.15 to 0.3.0
@@ -16,2 +16,4 @@ import Node from './Node'; | ||
classList: ClassList; | ||
scrollTop: number; | ||
scrollLeft: number; | ||
readonly attributesMap: { | ||
@@ -153,2 +155,8 @@ [k: string]: string; | ||
/** | ||
* Scrolls to a particular set of coordinates in the document. | ||
* | ||
* @note This method has not been implemented. It is just here for compatibility. | ||
*/ | ||
scrollTo(): void; | ||
/** | ||
* Converts to string. | ||
@@ -155,0 +163,0 @@ * |
@@ -44,2 +44,4 @@ "use strict"; | ||
_this.classList = new ClassList_1.default(_this); | ||
_this.scrollTop = 0; | ||
_this.scrollLeft = 0; | ||
_this.attributesMap = {}; | ||
@@ -342,2 +344,8 @@ return _this; | ||
/** | ||
* Scrolls to a particular set of coordinates in the document. | ||
* | ||
* @note This method has not been implemented. It is just here for compatibility. | ||
*/ | ||
Element.prototype.scrollTo = function () { }; | ||
/** | ||
* Converts to string. | ||
@@ -344,0 +352,0 @@ * |
@@ -11,2 +11,6 @@ import Element from './Element'; | ||
tabIndex: number; | ||
offsetHeight: number; | ||
offsetWidth: number; | ||
offsetLeft: number; | ||
offsetTop: number; | ||
/** | ||
@@ -13,0 +17,0 @@ * Returns inner text. |
@@ -29,2 +29,6 @@ "use strict"; | ||
_this.tabIndex = 0; | ||
_this.offsetHeight = 0; | ||
_this.offsetWidth = 0; | ||
_this.offsetLeft = 0; | ||
_this.offsetTop = 0; | ||
return _this; | ||
@@ -31,0 +35,0 @@ } |
{ | ||
"name": "happy-dom", | ||
"version": "0.2.15", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/capricorn86/happy-dom#readme", |
@@ -197,2 +197,4 @@ # Happy DOM | ||
| ------- | ---------- | ---------------- | | ||
| 0.3.0 | 2019-10-06 | Adds support for scrollTop, scrollLeft, scrollTo(), offsetLeft, offsetTop offsetHeight, offsetWidth. | | ||
| 0.2.16 | 2019-10-06 | Major bug fixes with server side rendering. | | ||
| 0.2.0 | 2019-09-20 | Adds support for SVGSVGElement, SVGElement and SVGGraphicsElement. | | ||
@@ -199,0 +201,0 @@ | 0.1.0 | 2019-09-19 | Adds support for HTMLInputElement, HTMLTextAreaElement, HTMLFormElement, Range and DOMRect (bounding client rect). | |
@@ -24,2 +24,4 @@ import Node from './Node'; | ||
public classList = new ClassList(this); | ||
public scrollTop = 0; | ||
public scrollLeft = 0; | ||
public readonly attributesMap: { [k: string]: string } = {}; | ||
@@ -310,2 +312,9 @@ | ||
/** | ||
* Scrolls to a particular set of coordinates in the document. | ||
* | ||
* @note This method has not been implemented. It is just here for compatibility. | ||
*/ | ||
public scrollTo(): void {} | ||
/** | ||
* Converts to string. | ||
@@ -312,0 +321,0 @@ * |
@@ -10,2 +10,6 @@ import Element from './Element'; | ||
public tabIndex: number = 0; | ||
public offsetHeight = 0; | ||
public offsetWidth = 0; | ||
public offsetLeft = 0; | ||
public offsetTop = 0; | ||
@@ -48,3 +52,3 @@ /** | ||
* | ||
* @override | ||
* @override | ||
* @param {string} name Name. | ||
@@ -58,7 +62,7 @@ * @param {string} value Value. | ||
const observedAttributes = Object.keys(observedPropertyAttributes); | ||
if(observedAttributes.includes(lowerName)) { | ||
if (observedAttributes.includes(lowerName)) { | ||
const property = observedPropertyAttributes[lowerName]; | ||
this[property] = typeof this[property] === 'boolean' ? value !== null : String(value); | ||
} | ||
} | ||
this[property] = typeof this[property] === 'boolean' ? value !== null : String(value); | ||
} | ||
} | ||
@@ -68,24 +72,24 @@ /** | ||
* | ||
* @override | ||
* @override | ||
* @param {string} rawAttributes Raw attributes. | ||
*/ | ||
public setRawAttributes(rawAttributes: string): void { | ||
super.setRawAttributes(rawAttributes); | ||
if(rawAttributes.trim()) { | ||
this.defineInitialProperties(); | ||
} | ||
super.setRawAttributes(rawAttributes); | ||
if (rawAttributes.trim()) { | ||
this.defineInitialProperties(); | ||
} | ||
} | ||
/** | ||
* Defines initial properties. | ||
*/ | ||
private defineInitialProperties(): void { | ||
private defineInitialProperties(): void { | ||
const observedPropertyAttributes = (<typeof HTMLElement>this.constructor)._observedPropertyAttributes; | ||
for(const name of Object.keys(observedPropertyAttributes)) { | ||
for (const name of Object.keys(observedPropertyAttributes)) { | ||
const attribute = this.attributesMap[name]; | ||
if(attribute !== null) { | ||
if (attribute !== null) { | ||
const property = observedPropertyAttributes[name]; | ||
switch(typeof this[property]) { | ||
switch (typeof this[property]) { | ||
case 'boolean': | ||
@@ -98,5 +102,5 @@ this[property] = true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
544974
13798
231