mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibWeb: Avoid updating muted state on muted content attribute changes
The `muted` content attribute should only affect the state of the `muted` IDL property when the media element is first created. The attribute should have no dynamic effect.
This commit is contained in:
parent
ed6f2f9b81
commit
8828e0d791
Notes:
github-actions[bot]
2025-06-26 21:16:18 +00:00
Author: https://github.com/tcl3
Commit: 8828e0d791
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5223
Reviewed-by: https://github.com/shannonbooth ✅
4 changed files with 44 additions and 2 deletions
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<video id="defaultMuted" muted=""></video>
|
||||
<video id="notDefaultMuted"></video>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const defaultMutedVideoElement = document.getElementById("defaultMuted");
|
||||
println("Initial muted state when muted content attribute is present: " + defaultMutedVideoElement.muted);
|
||||
defaultMutedVideoElement.muted = false;
|
||||
defaultMutedVideoElement.removeAttribute("muted");
|
||||
defaultMutedVideoElement.setAttribute("muted", "");
|
||||
println(`Changing the muted attribute after object creation changes the muted state: ${defaultMutedVideoElement.muted}`);
|
||||
defaultMutedVideoElement.remove();
|
||||
document.body.appendChild(defaultMutedVideoElement)
|
||||
println(`Re-inserting the video element into the document changes the muted state: ${defaultMutedVideoElement.muted}`);
|
||||
|
||||
const notDefaultMutedVideoElement = document.getElementById("notDefaultMuted");
|
||||
notDefaultMutedVideoElement.setAttribute("muted", "");
|
||||
notDefaultMutedVideoElement.remove();
|
||||
document.body.appendChild(notDefaultMutedVideoElement);
|
||||
println(`Re-inserting non-default muted video element into the document changes the muted state: ${notDefaultMutedVideoElement.muted}`);
|
||||
|
||||
const scriptCreatedVideoElement = document.createElement("video");
|
||||
scriptCreatedVideoElement.setAttribute("muted", "");
|
||||
document.body.appendChild(scriptCreatedVideoElement);
|
||||
println(`Muted state of a script-created video element after adding the muted content attribute ${scriptCreatedVideoElement.muted}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue