diff --git a/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt b/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt
new file mode 100644
index 00000000000..7d79d400f0d
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt
@@ -0,0 +1,51 @@
+button: unset
+button.getAttribute('formEnctype') == 'null'
+button.formEnctype == ''
+
+button.setAttribute('formEnctype', '')
+button.getAttribute('formEnctype') == ''
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', 'undefined')
+button.getAttribute('formEnctype') == 'undefined'
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', 'null')
+button.getAttribute('formEnctype') == 'null'
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', 'application/x-www-form-urlencoded')
+button.getAttribute('formEnctype') == 'application/x-www-form-urlencoded'
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', 'multipart/form-data')
+button.getAttribute('formEnctype') == 'multipart/form-data'
+button.formEnctype == 'multipart/form-data'
+
+button.setAttribute('formEnctype', 'text/plain')
+button.getAttribute('formEnctype') == 'text/plain'
+button.formEnctype == 'text/plain'
+
+button.setAttribute('formEnctype', 'APPLICATION/X-WWW-FORM-URLENCODED')
+button.getAttribute('formEnctype') == 'APPLICATION/X-WWW-FORM-URLENCODED'
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', 'MULTIPART/FORM-DATA')
+button.getAttribute('formEnctype') == 'MULTIPART/FORM-DATA'
+button.formEnctype == 'multipart/form-data'
+
+button.setAttribute('formEnctype', 'tEXt/PlAIn')
+button.getAttribute('formEnctype') == 'tEXt/PlAIn'
+button.formEnctype == 'text/plain'
+
+button.setAttribute('formEnctype', 'text/plain ')
+button.getAttribute('formEnctype') == 'text/plain '
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', '7')
+button.getAttribute('formEnctype') == '7'
+button.formEnctype == 'application/x-www-form-urlencoded'
+
+button.setAttribute('formEnctype', '5%')
+button.getAttribute('formEnctype') == '5%'
+button.formEnctype == 'application/x-www-form-urlencoded'
diff --git a/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt b/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt
new file mode 100644
index 00000000000..79d2ce9b5f0
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/form-formMethod-attribute.txt
@@ -0,0 +1,51 @@
+button: unset
+button.getAttribute('formMethod') == 'null'
+button.formMethod == ''
+
+button.setAttribute('formMethod', '')
+button.getAttribute('formMethod') == ''
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', 'undefined')
+button.getAttribute('formMethod') == 'undefined'
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', 'null')
+button.getAttribute('formMethod') == 'null'
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', 'get')
+button.getAttribute('formMethod') == 'get'
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', 'post')
+button.getAttribute('formMethod') == 'post'
+button.formMethod == 'post'
+
+button.setAttribute('formMethod', 'dialog')
+button.getAttribute('formMethod') == 'dialog'
+button.formMethod == 'dialog'
+
+button.setAttribute('formMethod', 'GeT')
+button.getAttribute('formMethod') == 'GeT'
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', 'POST')
+button.getAttribute('formMethod') == 'POST'
+button.formMethod == 'post'
+
+button.setAttribute('formMethod', 'DIAlog')
+button.getAttribute('formMethod') == 'DIAlog'
+button.formMethod == 'dialog'
+
+button.setAttribute('formMethod', 'foo')
+button.getAttribute('formMethod') == 'foo'
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', 'xpost')
+button.getAttribute('formMethod') == 'xpost'
+button.formMethod == 'get'
+
+button.setAttribute('formMethod', '5%')
+button.getAttribute('formMethod') == '5%'
+button.formMethod == 'get'
diff --git a/Tests/LibWeb/Text/input/form-formEnctype-attribute.html b/Tests/LibWeb/Text/input/form-formEnctype-attribute.html
new file mode 100644
index 00000000000..5588b2d0572
--- /dev/null
+++ b/Tests/LibWeb/Text/input/form-formEnctype-attribute.html
@@ -0,0 +1,27 @@
+
+
diff --git a/Tests/LibWeb/Text/input/form-formMethod-attribute.html b/Tests/LibWeb/Text/input/form-formMethod-attribute.html
new file mode 100644
index 00000000000..6d7d214078d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/form-formMethod-attribute.html
@@ -0,0 +1,23 @@
+
+
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl
index f373c070526..4f836f0a373 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl
@@ -16,8 +16,8 @@ interface HTMLButtonElement : HTMLElement {
[CEReactions, Reflect] attribute boolean disabled;
readonly attribute HTMLFormElement? form;
[CEReactions] attribute USVString formAction;
- [CEReactions, Reflect=formenctype] attribute DOMString formEnctype;
- [CEReactions, Reflect=formmethod] attribute DOMString formMethod;
+ [CEReactions, Reflect=formenctype, Enumerated=FormEnctypeAttribute] attribute DOMString formEnctype;
+ [CEReactions, Reflect=formmethod, Enumerated=FormMethodAttribute] attribute DOMString formMethod;
[CEReactions, Reflect=formnovalidate] attribute boolean formNoValidate;
[CEReactions, Reflect=formtarget] attribute DOMString formTarget;
[CEReactions, Reflect] attribute DOMString name;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
index 6ee8d2950c2..1d4e6a1737c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
@@ -24,6 +24,22 @@ enum MethodAttribute {
"dialog"
};
+// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formenctype
+[InvalidValueDefault=application/x-www-form-urlencoded]
+enum FormEnctypeAttribute {
+ "application/x-www-form-urlencoded",
+ "multipart/form-data",
+ "text/plain"
+};
+
+// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formmethod
+[InvalidValueDefault=get]
+enum FormMethodAttribute {
+ "get",
+ "post",
+ "dialog"
+};
+
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#selectionmode
enum SelectionMode {
"select",