mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibWeb: Fixed IDL for HTMLButtonElement
Use Enumerated for the form{Enctype, Method} attributes
This commit is contained in:
parent
6892482755
commit
ab04f6d422
Notes:
github-actions[bot]
2024-10-21 21:42:05 +00:00
Author: https://github.com/samu698
Commit: ab04f6d422
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1884
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/BodilessSleeper
Reviewed-by: https://github.com/stelar7
Reviewed-by: https://github.com/tcl3
6 changed files with 170 additions and 2 deletions
51
Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt
Normal file
51
Tests/LibWeb/Text/expected/form-formEnctype-attribute.txt
Normal file
|
@ -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'
|
51
Tests/LibWeb/Text/expected/form-formMethod-attribute.txt
Normal file
51
Tests/LibWeb/Text/expected/form-formMethod-attribute.txt
Normal file
|
@ -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'
|
27
Tests/LibWeb/Text/input/form-formEnctype-attribute.html
Normal file
27
Tests/LibWeb/Text/input/form-formEnctype-attribute.html
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<script src="./include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
const values = [
|
||||||
|
'', undefined, null,
|
||||||
|
'application/x-www-form-urlencoded',
|
||||||
|
'multipart/form-data',
|
||||||
|
'text/plain',
|
||||||
|
'APPLICATION/X-WWW-FORM-URLENCODED',
|
||||||
|
'MULTIPART/FORM-DATA',
|
||||||
|
'tEXt/PlAIn',
|
||||||
|
'text/plain ', '7', '5%'
|
||||||
|
];
|
||||||
|
|
||||||
|
println('button: unset');
|
||||||
|
println(`button.getAttribute('formEnctype') == '${btn.getAttribute('formEnctype')}'`);
|
||||||
|
println(`button.formEnctype == '${btn.formEnctype}'`);
|
||||||
|
for (value of values) {
|
||||||
|
btn.setAttribute('formEnctype', value);
|
||||||
|
println('');
|
||||||
|
println(`button.setAttribute('formEnctype', '${value}')`);
|
||||||
|
println(`button.getAttribute('formEnctype') == '${btn.getAttribute('formEnctype')}'`);
|
||||||
|
println(`button.formEnctype == '${btn.formEnctype}'`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
23
Tests/LibWeb/Text/input/form-formMethod-attribute.html
Normal file
23
Tests/LibWeb/Text/input/form-formMethod-attribute.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script src="./include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
const values = [
|
||||||
|
'', undefined, null,
|
||||||
|
'get', 'post', 'dialog',
|
||||||
|
'GeT', 'POST', 'DIAlog',
|
||||||
|
'foo', 'xpost', '5%'
|
||||||
|
];
|
||||||
|
|
||||||
|
println('button: unset');
|
||||||
|
println(`button.getAttribute('formMethod') == '${btn.getAttribute('formMethod')}'`);
|
||||||
|
println(`button.formMethod == '${btn.formMethod}'`);
|
||||||
|
for (value of values) {
|
||||||
|
btn.setAttribute('formMethod', value);
|
||||||
|
println('');
|
||||||
|
println(`button.setAttribute('formMethod', '${value}')`);
|
||||||
|
println(`button.getAttribute('formMethod') == '${btn.getAttribute('formMethod')}'`);
|
||||||
|
println(`button.formMethod == '${btn.formMethod}'`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -16,8 +16,8 @@ interface HTMLButtonElement : HTMLElement {
|
||||||
[CEReactions, Reflect] attribute boolean disabled;
|
[CEReactions, Reflect] attribute boolean disabled;
|
||||||
readonly attribute HTMLFormElement? form;
|
readonly attribute HTMLFormElement? form;
|
||||||
[CEReactions] attribute USVString formAction;
|
[CEReactions] attribute USVString formAction;
|
||||||
[CEReactions, Reflect=formenctype] attribute DOMString formEnctype;
|
[CEReactions, Reflect=formenctype, Enumerated=FormEnctypeAttribute] attribute DOMString formEnctype;
|
||||||
[CEReactions, Reflect=formmethod] attribute DOMString formMethod;
|
[CEReactions, Reflect=formmethod, Enumerated=FormMethodAttribute] attribute DOMString formMethod;
|
||||||
[CEReactions, Reflect=formnovalidate] attribute boolean formNoValidate;
|
[CEReactions, Reflect=formnovalidate] attribute boolean formNoValidate;
|
||||||
[CEReactions, Reflect=formtarget] attribute DOMString formTarget;
|
[CEReactions, Reflect=formtarget] attribute DOMString formTarget;
|
||||||
[CEReactions, Reflect] attribute DOMString name;
|
[CEReactions, Reflect] attribute DOMString name;
|
||||||
|
|
|
@ -24,6 +24,22 @@ enum MethodAttribute {
|
||||||
"dialog"
|
"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
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#selectionmode
|
||||||
enum SelectionMode {
|
enum SelectionMode {
|
||||||
"select",
|
"select",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue