diff --git a/packages/happy-dom/src/nodes/html-button-element/HTMLButtonElement.ts b/packages/happy-dom/src/nodes/html-button-element/HTMLButtonElement.ts
index ebf727de..74afecf7 100644
--- a/packages/happy-dom/src/nodes/html-button-element/HTMLButtonElement.ts
+++ b/packages/happy-dom/src/nodes/html-button-element/HTMLButtonElement.ts
@@ -1,7 +1,11 @@
import HTMLElement from '../html-element/HTMLElement';
import IHTMLButtonElement from './IHTMLButtonElement';
+const BUTTON_TYPES = ['submit', 'reset', 'button', 'menu'];
+
/**
+
+We can improve performance a bit if we make the types as a constant.
* HTML Button Element.
*
* Reference:
@@ -54,7 +58,7 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
* @returns Type
*/
public get type(): string {
- return this.sanitizeType(this.getAttributeNS(null, 'type'));
+ return this._sanitizeType(this.getAttributeNS(null, 'type'));
}
/**
@@ -70,10 +74,10 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
*
* @param type
*/
- private sanitizeType(type: string): string {
+ protected _sanitizeType(type: string): string {
type = (type && type.toLowerCase()) || 'submit';
- if (!['submit', 'reset', 'button', 'menu'].includes(type)) {
+ if (! BUTTON_TYPES.includes(type)) {
type = 'submit';
}