The #
(hash,sharp,pound) breaks your Javascript. Inside of an <svg>
tag pair (your closing tag is not provided) the entity number is being translated to it's proper character reference as it's rendered as html, then the engine executes the ECMA script (which it is allowed to do for drawing).
OWASP.org documents this as hex encoding without semicolons.