moonbat wrote: ↑2022-03-24, 11:28
Is that a separate issue, or a problem with the site's javascript?
Both. It is a JavaScript issue but a separate one from the regular expression parsing thing in JavaScript.
?. is "optional chaining". It is a shorthand form for checking if an object exists/isn't null before using a sub-object or property of it.
i.e. to check if an object is not null and get a property (already using shorthand here):
Code: Select all
let value = object && object.toCheck;
with optional chaining is written as
Because this is difficult to implement in our parser that doesn't expect such ambiguity in tokens, because both "?" and "."
already have very defined meanings in the parser, we don't support it at the moment and have focused on other important JS issues first. It would actually have been better to use a different operator altogether (instead of ".") to indicate not throwing and instead return null if the object is null than to make this weird combination of operators. It would have been just as easy for introduction to the programming community, but also completely unambiguous for implementers.
In a lot of sites that actually do have this employed, its primary goal (to save keystrokes) is actually irrelevant because the JavaScript code tends to be generated by some framework, and in that case it just becomes an arbitrary decision by whomever builds the "package" to not target ES6/ES2017 level browsers.