<!DOCTYPE html>
<title>Whitespace in <length> attribute values</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/whitespace-helper.js"></script>
<svg height="0"></svg>
<script>
// test length values
var EPSILON = Math.pow(2, -24); // float epsilon
var whitespace = [ "", " ", " ", "\r\n\t ", "\f" ];
var garbage = [ "a", "e", "foo", ")90" ];
var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ];
testType("<length>",
document.querySelector("svg"),
"x",
0, // expected default value
whitespace,
[ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], // valid
validunits,
garbage,
function(elm, value) {
assert_approx_equals(elm.x.baseVal.valueInSpecifiedUnits,
parseFloat(value), EPSILON);
},
function(elm, expected) {
assert_approx_equals(elm.x.baseVal.value, expected, EPSILON);
});
</script>