Files
sousa-gecko/testing/web-platform/tests/mathml/relations/html5-tree/anchor-hyperlinkutils-getter.html
T
tannal 6bdbdd1a2a Bug 2050394 [wpt PR 60892] - [mathml] Implement target and hyperlinkutils for MathML a element, a=testonly
Automatic update from web-platform-tests
[mathml] Implement target and hyperlinkutils for MathML a element

Adds wpt tests for href and target attributes

Adds wpt tests for HyperlinkUtils mixin for mathml a element

Bug: 510487697
Change-Id: I1cede1a6d1c76f25562f696454cd977673e58b85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7970997
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Frédéric Wang Nélar <fwang@igalia.com>
Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1652445}

--

wpt-commits: 6f870302908fb5a3b9e40e865c049ece2a29a557
wpt-pr: 60892
2026-07-06 08:45:45 +00:00

42 lines
1.6 KiB
HTML

<!doctype html>
<meta charset="utf-8">
<title>MathMLAnchorElement getters test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<math>
<a id=a1 href="http://google.com?hi">a1</a>
<a id=a2 href="http://google.com#somehash">a2</a>
<a id=a3 href="http://google.com:1234/somedir">a3</a>
<a id=a4 href="http://google.com:1234/somedir">a4</a>
<a id=a5 href="http://google.com:1234/somedir">a5</a>
<a id=a6 href="https://anonymous:flabada@developer.mozilla.org/en-US/docs/">a6</a>
<a id=a7 href="http://google.com:1234/somedir/someotherdir/index.html">a7</a>
<a id=a8 href="http://google.com:1234/somedir">a8</a>
<a id=a9 href="http://google.com/somedir">a9</a>
<a id=a10 href="https://anonymous:pwd@developer.mozilla.org:1234/en-US/">a10</a>
</math>
<script>
// Elements for each test: [property, result, id]
// [0] [1] [2]
tests = [
["search", "?hi", "a1"],
["hash", "#somehash", "a2"],
["host", "google.com:1234", "a3"],
["hostname", "google.com", "a4"],
["href", "http://google.com:1234/somedir", "a5"],
["password", "flabada", "a6"],
["pathname", "/somedir/someotherdir/index.html", "a7"],
["port", "1234", "a8"],
["protocol", "http:", "a9"],
["username", "anonymous", "a10"]
];
for (var i = 0; i < tests.length; i++) {
test(function () {
const [property, result, id] = tests[i];
var a = document.getElementById(id);
var r = a[property];
assert_equals(r, result);
}, `Getter for attribute of anchor element(${i}): ${tests[i][0]}`);
}
</script>