gecko-dev/layout/reftests/mathml/dtls-3.html

217 строки
5.5 KiB
HTML
Исходник Обычный вид История

<!DOCTYPE html>
<html class="reftest-wait">
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
}
</style>
</head>
<body>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true" id="mover0">
<mo mathvariant="fraktur">a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur" id="mo0"></mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur" id="mo1">a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';" id="mstyle0">
</mstyle>
</math>
<p>
<math>
<mstyle id="mstyle1">
<mover accent="true">
<mover accent="true">
<mn mathvariant="fraktur">a</mn>
<mn mathvariant="fraktur">a</mn>
</mover>
<mover accent="true">
<mn mathvariant="fraktur">a</mn>
<mn mathvariant="fraktur">a</mn>
</mover>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true">
<mrow>
<mrow>
<mrow id="mrow0">
</mrow>
</mrow>
</mrow>
<mo mathvariant="fraktur">a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle id="mstyle4" style ="font-family: 'dtls-1'; font-feature-settings: 'dtls' 0">
<mover accent="true">
<mover accent="true">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
<mover accent="true">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle id="mstyle5" style ="font-family: 'dtls-1';">
<mover accent="true">
<mover accent="true">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
<mover accent="true">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover id="mover1">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true" id="mover2">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true" id="mover3">
<mo mathvariant="fraktur">a</mo>
<mo mathvariant="fraktur">a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true">
<mo id="mo2">a</mo>
<mo>a</mo>
</mover>
</mstyle>
</math>
<p>
<math>
<mstyle style="font-family: 'dtls-1';">
<mover accent="true">
<mo mathvariant="fraktur" id="mo3">a</mo>
<mo>a</mo>
</mover>
</mstyle>
</math>
<script>
function doTest()
{
var mo = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mo");
mo.innerHTML = "a";
mo.setAttribute("mathvariant", "fraktur");
// An added child gets dtls font feature
document.getElementById("mover0").appendChild(mo);
// A child with changed text gets dtls font feature
document.getElementById("mo0").innerHTML = "a";
// A relocated child loses dtls font feature setting
document.getElementById("mstyle0").appendChild(document.getElementById("mo1"));
// A change in style
document.getElementById("mstyle1").setAttribute("style", "font-family: 'dtls-1';");
// dtls gets added to descendants as well
var mo1 = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mo");
mo1.innerHTML = "a";
mo1.setAttribute("mathvariant", "fraktur");
document.getElementById("mrow0").appendChild(mo1);
// removing explicit dtls setting works
document.getElementById("mstyle4").setAttribute(
"style", "font-family: 'dtls-1';")
// setting an explicit dtls font feature
document.getElementById("mstyle5").setAttribute(
"style" , "font-family: 'dtls-1'; font-feature-settings: 'dtls' 0");
// Adding accent="true" applies dtls font feature
document.getElementById("mover1").setAttribute("accent", "true");
// Changing accent="true" to false removes dtls font feature
document.getElementById("mover2").setAttribute("accent", "false");
// Removing accent="true" removes dtls font feature
document.getElementById("mover3").removeAttribute("accent");
// dtls applies when mathvariant is set
document.getElementById("mo2").setAttribute("mathvariant", "fraktur");
// dtls still applies when mathvariant is removed
document.getElementById("mo3").removeAttribute("mathvariant");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</body>
</html>