(where does useSVG come from, for example)
Ah. That bit's gone from my version.
The library supports both SVG and VML, and useSVG is a global that is set either manually at the topmost level or by detecting the useragaent. I'm not interested in supporting old IEs, so I've already stripped all the useSVG and VML stuff out.
I've also separated out all the branches of the sub and at this point that sub reduces to:
function _OAV( oo,aa,vv ) { //Object, Attribute, Value
oo.setAttribute( aa,vv );
}
function fromOV( oo, vv ) {
oo.setAttribute( "x1", vv.split( "," )[0] );
oo.setAttribute( "y1", vv.split( "," )[1] );
}
function toOV( oo, vv ) {
oo.setAttribute( "x2", vv.split( "," )[0] );
oo.setAttribute( "y2", vv.split( "," )[1] );
}
function colorOV( oo, vv ) {
oo.setAttribute( "fill", vv );
}
function innerTextOV( oo, vv ) {
oo.firstChild.replaceData( 0, 108, vv );
}
Most of those will be inlined back into the main code; with only the fromOV() & toOV() which set two attributes left to deal with. The current practice of concatenating the two values together in the calling code and then splitting them in the functions will go. Not sure beyond that.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
|