Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!doctype html>
<html>
<head>
<title>The marker attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<span id="s_no_marker"></span>
<span id="s_marker" marker="marker1"></span>
<span id="s_2_markers" marker="marker1 marker2"></span>
<script>
"use strict";
test(function () {
assert_equals(s_no_marker.marker, "");
}, "Access to .marker returns an empty string");
test(function () {
assert_equals(s_2_markers.marker, "marker1 marker2");
}, "Multiple names stay a single string");
test(function () {
assert_equals(s_no_marker.marker, "");
s_no_marker.marker = "marker1";
assert_equals(s_no_marker.marker, "marker1");
}, "Setting .marker updates the attribute.");
test(function () {
const element = document.createElement("div");
element.setAttribute("marker", " marker1 ");
assert_equals(element.marker, " marker1 ");
}, "marker retains whitespace");
</script>
</body>
</html>