@expressen/tallahassee
Advanced tools
Comparing version 11.13.0 to 11.14.0
Changelog | ||
========= | ||
## 11.14.0 | ||
- add `method` and `action` properties to form element | ||
## 11.13.0 | ||
@@ -5,0 +9,0 @@ |
@@ -9,2 +9,4 @@ "use strict"; | ||
const originSymbol = Symbol.for("origin"); | ||
module.exports = class HTMLFormElement extends Element { | ||
@@ -34,2 +36,4 @@ constructor(document, $elm) { | ||
this[originSymbol] = document.location.href; | ||
return new Proxy(element, nameHandler); | ||
@@ -40,2 +44,23 @@ } | ||
} | ||
get method() { | ||
return (this.getAttribute("method") || "get").toLowerCase(); | ||
} | ||
set method(val) { | ||
const validMethods = ["get", "post"]; | ||
if (typeof val === "string" && validMethods.includes(val.toLowerCase())) { | ||
const method = val.toLowerCase(); | ||
this.setAttribute("method", method); | ||
} else { | ||
this.setAttribute("method", "get"); | ||
} | ||
return val; | ||
} | ||
get action() { | ||
return this.getAttribute("action") || this[originSymbol]; | ||
} | ||
set action(val) { | ||
this.setAttribute("action", val); | ||
return val; | ||
} | ||
submit() { | ||
@@ -42,0 +67,0 @@ this.dispatchEvent(new Event("_form_submit", { bubbles: true })); |
{ | ||
"name": "@expressen/tallahassee", | ||
"version": "11.13.0", | ||
"version": "11.14.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
109470
3042