Closed btea closed 6 months ago
It looks like this is your first pull request. 🎉 Thank you for your contribution! One of the project maintainers will triage and assign the pull request for review. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.
Thanks a lot for raising this one. I'm going to close, however, because I get the following:
The error message here is browser-specific so it's safe enough to leave as-is.
Thanks!
@bsmth Is it because of the browser difference? The error message I get is as follows:
The browser version I am using is Edge 121.0.2277.128.
Yes, I can confirm if you try it with Chrome, you get the following:
> Array ["en-US"]
> Array ["en-US", "fr"]
> "RangeError: Incorrect locale information provided"
And Safari:
> Array ["en-US"]
> Array ["en-US", "fr"]
> "RangeError: invalid language tag: EN_US"
The error messages of Firefox and Safari are consistent, and the output messages of Chrome and node are consistent. Maybe add both error messages and then mark the running environment?
We can add both to cover Chrome, Fx and Safari, why not. This can also be verified using eshost
'Intl.getCanonicalLocales("EN_US")'
┌──────────────┬───────────────────────────────────────────────────┐
│ SpiderMonkey │ │
│ │ RangeError: invalid language tag: "EN_US" │
├──────────────┼───────────────────────────────────────────────────┤
│ V8 │ │
│ │ RangeError: Incorrect locale information provided │
└──────────────┴───────────────────────────────────────────────────┘
mark the running environment
The running environment is the reader's browser in this case, so I don't think we need to do anything else there.
Do we do this elsewhere?
I don't care much for these examples but I also don't think it's helpful when the message has the same meaning anyway.
Do we do this elsewhere?
We do have a few:
live-examples/js-examples/intl/intl-listformat-prototype-resolvedoptions.js:// Expected output (Chrome): "de"
live-examples/js-examples/intl/intl-numberformat-prototype-resolvedoptions.js:// Expected output (Chrome): "de"
live-examples/js-examples/weakset/weakset-prototype-add.js: // Expected output (Chrome): TypeError: Invalid value used in weak set
live-examples/js-examples/symbol/symbol-match.js:// Expected output (Chrome): Error: First argument to String.prototype.startsWith must not be a regular expression
And actually I just spotted we have this in the style guide: https://github.com/mdn/interactive-examples/blob/main/contributing/javascript-style-guide.md#representing-browser-differences
I also don't think it's helpful when the message has the same meaning anyway
I tend to agree somewhat, my initial decision was to close for this reason, but I can see why some readers might be confused. I would format it like the suggestion in the style guide and merge, unless you have objections, @Josh-Cena.
That "browser difference" is actual runtime difference, but this one is just a representational difference. I don't have strong objections, though.
That "browser difference" is actual runtime difference, but this one is just a representational difference. I don't have strong objections, though.
You're right. Let's go with this for now 👍🏻
Congratulations on your first merged pull request. 🎉 Thank you for your contribution! Did you know we have a project board with high-impact contribution opportunities? We look forward to your next contribution.
Description
Motivation
Additional details
Related issues and pull requests