Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
blob: f420f22aba5cf5b1fe0cfacbe39da851e9374374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const svgns = 'http://www.w3.org/2000/svg';
const [icon, use] = ['svg', 'use'].map(t => document.createElementNS(svgns, t));

icon.setAttributeNS(null, 'viewBox', '-6 -6 12 12');
icon.setAttribute('xmlns', svgns);
icon.classList.add('weapon-icon');

// use.setAttributeNS(null, 'href', `assets/images/counters.svg#rifle`);
use.setAttributeNS(null, 'href', `assets/images/counters2.svg#smg`);

icon.appendChild(use);

document.querySelector('body').appendChild(icon);