mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
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:
parent
413cf6b329
commit
06154b87dd
Notes:
github-actions[bot]
2024-11-06 09:57:52 +00:00
Author: https://github.com/pbrw
Commit: 06154b87dd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2174
Reviewed-by: https://github.com/rmg-x
13 changed files with 172 additions and 0 deletions
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-1.html
Normal file
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-1.html
Normal 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>
|
27
Tests/LibWeb/Text/input/HTML/lang-pragma-set-2.html
Normal file
27
Tests/LibWeb/Text/input/HTML/lang-pragma-set-2.html
Normal 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>
|
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-3.html
Normal file
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-3.html
Normal 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>
|
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-4.html
Normal file
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-4.html
Normal 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>
|
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-5.html
Normal file
25
Tests/LibWeb/Text/input/HTML/lang-pragma-set-5.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue