Let's say we have an SVG with an element/scope named aLine. In the parent scope, we can say @aLine to refer to this scope.
But if we say aLine without the @, we end up referring to a reference to the DOM element that was added to the window object. I believe the browser does this automatically, because the element has id="aLine".
The problem is.. if someone types aLine.pressure = 5, it won't throw an error. It should, because they meant to type @aLine.pressure = 5 and forgot the @.
So we need to find a way to scrub all these element references off the window, so that if you say aLine.pressure you get an error.
We can say window.aLine = null and that will work. But — better — we should overwrite the window element references with our own custom objects, so we can throw a nice error like You typed aLine when you probably meant to type @aLine
Let's say we have an SVG with an element/scope named
aLine
. In the parent scope, we can say@aLine
to refer to this scope.But if we say
aLine
without the @, we end up referring to a reference to the DOM element that was added to the window object. I believe the browser does this automatically, because the element hasid="aLine"
.The problem is.. if someone types
aLine.pressure = 5
, it won't throw an error. It should, because they meant to type@aLine.pressure = 5
and forgot the @.So we need to find a way to scrub all these element references off the window, so that if you say
aLine.pressure
you get an error.We can say
window.aLine = null
and that will work. But — better — we should overwrite the window element references with our own custom objects, so we can throw a nice error likeYou typed aLine when you probably meant to type @aLine