LibWeb: Support for "content-language" http-equiv state

Implemented support for setting the pragma-set default language in the
`<meta/>` tag with an `http-equiv` attribute `content-language`.
This commit is contained in:
Piotr 2024-11-05 09:12:11 +01:00 committed by Andreas Kling
commit 06154b87dd
Notes: github-actions[bot] 2024-11-06 09:57:52 +00:00
13 changed files with 172 additions and 0 deletions

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko" >
<style type='text/css'>
.test div { width: 50px; background-color: red; }
#box:lang(ko) { width: 100px; background-color: limegreen; }
</style>
</head>
<body>
<div class="test"><div id="box">TEST</div></div>
</body>
</html>
<script src="../include.js"></script>
<script>
asyncTest((done) => {
if (document.getElementById('box').offsetWidth == 100) {
println("OK");
} else {
println("FAIL. If there is a pragma-set default language set, then that is the language of the node.");
}
done();
});
</script>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="
ko
som! ?et #$% hi;0 ng " >
<style type='text/css'>
.test div { width: 50px; background-color: red; }
#box:lang(ko) { width: 100px; background-color: limegreen; }
</style>
</head>
<body>
<div class="test"><div id="box">TEST</div></div>
</body>
</html>
<script src="../include.js"></script>
<script>
asyncTest((done) => {
if (document.getElementById('box').offsetWidth == 100) {
println("OK");
} else {
println("FAIL. If there is a pragma-set default language set, then that is the language of the node. It should match the first non-whitespace code points from the contet attribute.");
}
done();
});
</script>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko,pl" >
<style type='text/css'>
.test div { width: 50px; background-color: limegreen; }
#box:lang(ko) { width: 100px; background-color: red; }
</style>
</head>
<body>
<div class="test"><div id="box">TEST</div></div>
</body>
</html>
<script src="../include.js"></script>
<script>
asyncTest((done) => {
if (document.getElementById('box').offsetWidth == 50) {
println("OK");
} else {
println("FAIL. If the element's content attribute contains a U+002C COMMA character (,) then return.");
}
done();
});
</script>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="" >
<style type='text/css'>
.test div { width: 50px; background-color: limegreen; }
#box:lang(ko) { width: 100px; background-color: red; }
</style>
</head>
<body>
<div class="test"><div id="box">TEST</div></div>
</body>
</html>
<script src="../include.js"></script>
<script>
asyncTest((done) => {
if (document.getElementById('box').offsetWidth == 50) {
println("OK");
} else {
println("FAIL. If candidate is the empty string, return.");
}
done();
});
</script>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" >
<style type='text/css'>
.test div { width: 50px; background-color: limegreen; }
#box:lang(ko) { width: 100px; background-color: red; }
</style>
</head>
<body>
<div class="test"><div id="box">TEST</div></div>
</body>
</html>
<script src="../include.js"></script>
<script>
asyncTest((done) => {
if (document.getElementById('box').offsetWidth == 50) {
println("OK");
} else {
println("FAIL. If the meta element has no content attribute, then return.");
}
done();
});
</script>
</html>