Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/record_sheet.js')
-rw-r--r--src/modules/record_sheet.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js
index 2865309..33a21fe 100644
--- a/src/modules/record_sheet.js
+++ b/src/modules/record_sheet.js
@@ -81,12 +81,13 @@ function createWeaponIcon(type) {
function createRecord(unit) {
const { dataset: { allegiance, number, squad }} = unit,
primaryWeapon = unit.querySelector('.primary-weapon'),
- pw = primaryWeapon?.getAttribute('href').replace('#', '') || 'rifle',
+ pw = primaryWeapon.getAttributeNS(null, 'href').split('#').pop() || 'rifle',
div = document.createElement('div', { is: 'soldier-record-block' }),
spans = Array(6).fill('span').map(t => document.createElement(t)),
[tn, sn, pwt, pwd, pwrs, pwrl] = spans;
- div.setAttribute('class', 'soldier-record');
+ div.classList.add('soldier-record');
+ if (unit.classList.contains('selected')) div.classList.add('selected');
div.dataset.number = number;
div.dataset.allegiance = allegiance;