Skip to content

Commit 5e8c78a

Browse files
committed
Use optional chaining to avoid polluting the global namespace
See https://www.woltlab.com/community/thread/315934/
1 parent 821676f commit 5e8c78a

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

com.woltlab.wcf/templates/messageUserOptionOutput.tpl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
</div>
77

88
<script data-relocate="true">
9-
const element = document.getElementById('{unsafe:$option->optionName|encodeJS}');
10-
if (element) {
11-
const dl = element.closest('dl');
12-
if (dl) {
13-
dl.classList.add('wide');
14-
}
15-
}
9+
document.getElementById('{unsafe:$option->optionName|encodeJS}')?.closest('dl')?.classList.add('wide');
1610
</script>
1711
{/hascontent}

0 commit comments

Comments
 (0)