meraproject/lib/js/bws/svg.js

47 lines
998 B
JavaScript
Raw Normal View History

var SVG;
SVG = {
create: function(type, attr) {
var i, l;
l = document.createElementNS('http://www.w3.org/2000/svg', type);
for (i in attr) {
l.setAttribute(i, attr[i]);
}
return l;
},
createSvg: function() {
return SVG.create('svg', {
style: 'width:100%;height:100%',
'xmlns': 'http://www.w3.org/2000/svg'
});
}
};
/*
(($)->
$.fn.SVG = (method)->
if (F[method])
F[method].apply( this, Array.prototype.slice.call(arguments,1) )
else if typeof method == "object" || !method
F.init.apply(this,arguments)
else
$.error('Метод с именем '+method+' не существует для jQuery.SVG')
create:(type,attr)->
l = document.createElementNS('http://www.w3.org/2000/svg',type)
for i of attr
l.setAttribute(i,attr[i])
l
createSvg:->
SVG.create('svg',{style:'width:100%;height:100%','xmlns':'http://www.w3.org/2000/svg'})
F =
init:(x)->
console.log 'init',x
test:(x,y)->
console.log('SVG test',x,y)
)(jQuery)
*/