mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 21:57:18 +00:00
LibWeb: Treat execCommand
command names as case insensitive
This commit is contained in:
parent
26ea5335c7
commit
dccb374876
Notes:
github-actions[bot]
2025-02-08 12:31:22 +00:00
Author: https://github.com/tcl3
Commit: dccb374876
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3470
3 changed files with 46 additions and 8 deletions
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<body></body>
|
||||
<script>
|
||||
function execCommandCaseInsensitivityTest(command) {
|
||||
return new Promise((resolve) => {
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.srcdoc = `<div>PASS</div>`;
|
||||
document.body.appendChild(iframe);
|
||||
iframe.onload = () => {
|
||||
const iframeDocument = iframe.contentDocument;
|
||||
iframeDocument.execCommand(command);
|
||||
|
||||
const selection = iframeDocument.getSelection();
|
||||
println(`queryCommandSupported("${command}"): ${iframeDocument.queryCommandSupported(command)}`);
|
||||
println(`queryCommandEnabled("${command}"): ${iframeDocument.queryCommandEnabled(command)}`);
|
||||
println(`execCommand("${command}"): ${selection.toString()}`);
|
||||
iframe.remove();
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
asyncTest(async done => {
|
||||
for (command of ["selectall", "SELECTALL", "SeLeCtAlL"]) {
|
||||
await execCommandCaseInsensitivityTest(command);
|
||||
}
|
||||
done();
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue