Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-img-element/img-src-encoding-parse.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="windows-1252">
<title>img uses encoding-parse</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
async_test(t => {
const img = document.createElement('img');
img.onload = t.step_func(() => {
assert_equals(
new URL(img.currentSrc).search,
'?x=%DF',
'image URL should use windows-1252 encoding');
t.done();
});
img.onerror = t.unreached_func('image should load');
img.src = 'image.png?x=\u00DF';
document.body.appendChild(img);
}, 'img src should use document encoding.');
</script>
</body>