3 ms·
From https://plainvanillaweb.com/pages/components.html https://plainvanillaweb.com/pages/components.html I see this piece: if (!this.#span) What is that k
by mschuster91 1y ago
From https://plainvanillaweb.com/pages/components.html https://plainvanillaweb.com/pages/components.html I see this piece:
if (!this.#span)
What is that kind of magic syntax sugar?! A shorthand for document.getElementById?
- zero_shift 1y agoNo, the hash is a red herring. It's a way of signifying a private field on an object.
- mschuster91 1y agoAh. Thanks, that hint pointed me to [1]. Seems like it's been supported by every major browser since 2021, and only specified in the upcoming ECMAScript 2026 spec. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_properties https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- zero_shift 1y agoIt has a contentious history and largely was forced through by one person in TC39 who focused on a particular corner case