<!DOCTYPE html>
<link rel="author" title="Xiaocheng Hu" href="mailto:[email protected]">
<link rel="help" href="https://www.w3.org/TR/css-typed-om-1/#stylevalue-subclasses">
<link rel="match" href="rotate-by-added-angle-ref.html">
<meta name="assert" content="CSSUnitValue of different angle units can be added correctly.">
<style>
.common {
width: 200px;
height: 100px;
position: absolute;
top: 100px;
left: 100px;
}
.ref {
transform: rotate(90deg);
background-color: red;
}
.test {
background-color: green;
z-index: 1;
}
</style>
<p>Test passes if there is a filled green rectangle with <strong>no red</strong>.</p>
<div class="common ref"></div>
<div class="common test"></div>
<script>
const angle = new CSSMathSum(CSS.deg(45), CSS.turn(0.125)); // 90 degrees
const transform = new CSSTransformValue([new CSSRotate(angle)]);
const target = document.querySelector('.test');
target.attributeStyleMap.set('transform', transform);
</script>