@expressen/tallahassee
Advanced tools
Comparing version 14.0.0 to 14.2.0
@@ -6,2 +6,6 @@ Changelog | ||
## 14.2.0 | ||
- added `form` attribute submit | ||
## 14.0.0 | ||
@@ -8,0 +12,0 @@ |
@@ -196,2 +196,6 @@ "use strict"; | ||
get form() { | ||
const attributeForm = this.getAttribute("form"); | ||
if (attributeForm) { | ||
return this.ownerDocument.getElementById(attributeForm); | ||
} | ||
return this._getElement(this.$elm.closest("form")); | ||
@@ -198,0 +202,0 @@ } |
@@ -7,2 +7,14 @@ "use strict"; | ||
module.exports = class HTMLButtonElement extends Element { | ||
constructor(document, $elm) { | ||
super(document, $elm); | ||
this.ownerDocument.addEventListener("click", (e) => { | ||
if (this.form && !e.defaultPrevented) { | ||
const parentForm = this.closest("form"); | ||
if (!parentForm || parentForm !== this.form) { | ||
const form = this.ownerDocument.getElementById(this.form.id); | ||
form.submit(); | ||
} | ||
} | ||
}); | ||
} | ||
get disabled() { | ||
@@ -24,2 +36,3 @@ return this.$elm.prop("disabled"); | ||
} | ||
get type() { | ||
@@ -38,2 +51,3 @@ const type = this.getAttribute("type"); | ||
if (this.disabled) return; | ||
const clickEvent = new PointerEvent("click", { bubbles: true }); | ||
@@ -40,0 +54,0 @@ this.dispatchEvent(clickEvent); |
{ | ||
"name": "@expressen/tallahassee", | ||
"version": "14.0.0", | ||
"version": "14.2.0", | ||
"description": "Lightweight client testing framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
128954
3668