Comments (9)
It maybe isn't a big enough deal to warrant changing all the files, but it'd always be preferable from the consumer side of things for the JSON to have only one data type if possible.
For my BCD Explorer, I have to write code like this when parsing the notes:
if (jsonKeys.includes('notes')) {
if (Array.isArray(json.notes)) {
contentForPopover.set("notes", `Notes: ${json.notes.join("<br>")}`);
} else {
contentForPopover.set("notes", `Notes: ${json.notes}`);
}
}
when I could be writing it something like this:
if (jsonKeys.includes('notes')) {
contentForPopover.set("notes", `Notes: ${json.notes.join("<br>")}`);
}
from browser-compat-data.
I'm not sure I buy the consistency argument and support_statement
is a completely different story to me. Generally, I think having more options will lead to more code, and I think making notes always arrays, would reduce access complexity for at least this property.
from browser-compat-data.
Now that the macro implementation is done for both paths, I don't have any strong feelings anymore either 😆 This would be a good issue for feedback from other consumers, but unfortunately we don't have any (known) users of the data yet.
from browser-compat-data.
We discussed this in Toronto.
I think the version of the schema that we looked at in Toronto had this array-or-string dual form for support_statement
but not for notes
. There was discussion about whether support_statement
should have this dual form. It was decided that it should, then someone said, shouldn't notes
have the dual form as well, so as to be consistent.
I agree that having only one form makes the schema and the parsing code both simpler, so that's a good argument in its favour. But having already made the decision one way before, we should be careful we're not overlooking any arguments on the other side. And should we do the same for support_statement
?
Note that I'm inconsistent too: the WebExtensions macro assumes that support_statement
is a single simple_support_statement
object, which works because all the WE data is currently single simple_support_statement
. But it shouldn't, really.
from browser-compat-data.
Since we're not putting any code in the notes, supporting multiples statements is a straightforward way to separate notes on different topics.
from browser-compat-data.
FWIW I agree with you, although I don't feel strongly either way.
from browser-compat-data.
Late feedback from my side, though I agree with @Elchi3's initial argument that notes
written in plural form is an indicator for only allowing arrays. Looks like that's the only argument that's still valid after the macro implementation now supports both.
Sebastian
from browser-compat-data.
I feel that it should always be an array, for consistency in part, but mainly because it simplifies code paths when interpreting the data, reducing the chances for bugs to occur.
from browser-compat-data.
We've been living with the two paths for a long time now and accept "string or array" for other properties as well, so I think we won't fix this after all.
from browser-compat-data.
Related Issues (20)
- api.ClipboardEvent.clipboardData - Incorrect availability banner HOT 1
- css.properties.letter-spacing - <Google chrome handle letter spacing diff> HOT 1
- html.textarea.spellcheck - duplicated global attributes
- api.fetch - Safari 17.2 supports setting priority of fetch HOT 3
- html.elements.image - <SUMMARIZE THE PROBLEM> HOT 1
- http.headers.Alt-Svc - Safari Alt-Svc compatibility is outdated
- html.elements.mark - Support in screen readers is mixed HOT 15
- http.status.503 - <SUMMARIZE YOUR PROBLEM> HOT 1
- http.status.504 - <SUMMARIZE THE PROBLEM> HOT 1
- api.File.type - duplicated data between `api.File.type` and `api.Blob.type`
- css.selectors.has - Baseline status banner incorrect HOT 1
- api.RTCRtpReceiver.transform - Chrome support encoded stream transform HOT 3
- api.HTMLAnchorElement.hrefTranslate&html.elements.a.hreftranslate - Missing browser compat data HOT 1
- api.KeyboardEvent.keyCode - <SUMMARIZE THE PROBLEM> HOT 1
- webextensions.api.userScripts - Chrome now supports userscripts HOT 2
- css.selectors.host - Discrepancies between the baseline widget and the full compatibility table HOT 1
- css.properties.font-family - < is not working> HOT 2
- api.File - The type of python file in Windows's browser is not recognized HOT 1
- html.elements.input.type_file - The type of python file in some Windows's browser is not recognized HOT 1
- webextensions.manifest.browser_specific_settings - `gecko_android` for `Firefox` should not be No HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browser-compat-data.