Re:TinyJS – Shorten JavaScript QuerySelect with $ and $$
by nattaylor on Wednesday October 02, 2024 @05:52PM
(#41725309)
Sorry, I didn't mean to suggest your solution was brittle -- I actually quite like it and want to adopt it!
But I do think the legacy browser behavior with the ID attribute as window properties is very brittle for the reasons you suggest
Re:TinyJS – Shorten JavaScript QuerySelect with $ and $$
by akira2501 on Wednesday October 02, 2024 @06:27PM
(#41725522)
My fault, I tend to "rapid fire" sometimes. Yours was next to another reply on the identical subject and that caused me to mistake the meaning of the comma in your sentence.
Reading it more slowly, I see it now, and, thank you!
The reason to have a separate system that correctly calls getElementById() is to avoid this issue.
So, it's actually a _less_ brittle mechanism that doesn't rely on legacy mechanisms and lacks the surprises that come with that.