top | item 41725207 (no title) nattaylor | 1 year ago If you like brittle things, the id attribute is already made into an attribute on the window for legacy reasonsEdit: My tone may have indicated that parent's solution was brittle. It's not! discuss order hn newest akira2501|1 year ago The id attribute can take on values that are already present or reserved in window. "fetch", "opener", etc..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. nattaylor|1 year ago 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 load replies (1) cies|1 year ago Nah, i rather skip brittle :) But what's not brittle in JS? Elm? (TS to some extend)
akira2501|1 year ago The id attribute can take on values that are already present or reserved in window. "fetch", "opener", etc..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. nattaylor|1 year ago 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 load replies (1)
nattaylor|1 year ago 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 load replies (1)
akira2501|1 year ago
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.
nattaylor|1 year ago
But I do think the legacy browser behavior with the ID attribute as window properties is very brittle for the reasons you suggest
cies|1 year ago