Skip to content

Commit ecb2ba2

Browse files
committed
Fix code
1 parent 8c59b22 commit ecb2ba2

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/browserlib/map-ids-to-headings.mjs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,22 @@ export default function () {
8787

8888
if (parentSection) {
8989
const ids = [];
90-
let id;
9190

9291
const heading = parentSection.heading;
9392
if (heading.id) {
94-
id = heading.id;
93+
ids.push(heading.id);
9594
href = getAbsoluteUrl(heading, { singlePage });
96-
ids.push(id);
9795
}
9896
else {
9997
const anchor = heading.querySelector('a[name]');
10098
if (anchor) {
101-
id = anchor.getAttribute('name');
99+
ids.push(anchor.getAttribute('name'));
102100
href = getAbsoluteUrl(anchor, { singlePage, attribute: 'name' });
103-
ids.push(id);
104101
}
105102
}
106103

107104
if (parentSection.root && parentSection.root.id) {
108-
id = parentSection.root.id;
105+
ids.push(parentSection.root.id);
109106
href = getAbsoluteUrl(parentSection.root, { singlePage });
110107
}
111108

@@ -114,10 +111,6 @@ export default function () {
114111
const number = match ? match[1] : null;
115112

116113
const mapping = {};
117-
if (id) {
118-
ids.push(id);
119-
120-
}
121114
if (ids.length) {
122115
mapping.id = ids.pop();
123116
}

0 commit comments

Comments
 (0)