-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use prefixes for CSS properties #534
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. |
My first idea was I've always been taught to not screw around with user-agent parsing and this wouldn't work on all browsers in the same way so I'm unsure if "implemented correctly" is non-trivial or even possible. |
Structured browser compat data (aka BCD) is a wonderful project with lots of interesting applications both inside and outside the MDN website itself. But I'm not convinced it's appropriate here (although I could be convinced, perhaps). I think it's worth thinking about what exactly our problem is and how we would like the editor to behave:
BCD is great for answering questions like: "which browsers (vendors and versions) support this feature?". But we have a slightly different question: "does this particular browser support this feature?". For individual example choices, it's an even more concrete question: "does this particular browser support this particular bit of CSS"? And there's an alternative way to answer that question, which is what we do now: just test it. We could use BCD in situations like (3) above - where we just want to know at a high level if an item is supported, and maybe not show the editor at all if it isn't. But even in this case its not obvious that this is superior to what we do now (for example, what about versions? What if our browser just added support, but the user is on an older browser. Does this mean we have to figure out the version of our browser and compare that with the BCD? Why would we do that, when we can just test it?). For more fine-grained situations it gets harder. For example, consider I don't think this is a failing of BCD: I don't think it's realistic to expect BCD to be able to express this kind of stuff in a way that's easily machine-mapped to some CSS. Still, I think we would be better off finding out if some CSS is supported by trying to apply it in the browser. One difficulty with this approach would be dealing with syntax errors: if some CSS fails to apply, is it because the browser doesn't support it, or because the CSS is invalid? For the initial choices given in the editors, we should be able to assume it's correct of course, but when the user edits a choice, we should check it's valid. For this I think we should look at https://github.com/csstree/validator to validate the CSS: then if it's valid, try to apply it, and if it doesn't apply, treat it as unsupported. |
That confirms the issues I believed that the BCD system would have for this use. Using what we do now we can look for vendor prefixes fairly easily the same way. Maybe an indication badge on the editor for if it finds and uses a prefixed version would be better than hardcoding and showing all prefixes to save vertical space. autoprefixer is also interesting and could possibly play a role. To add all prefixes rather than detected ones if that is better. The validator is a great idea and totally should be used. I think that'd be very helpful for people learning the syntax (or me with that obnoxious background shorthand haha). It doesn't look like any of these solutions can solve the issue of not knowing if a certain property of a value is compatible. Is that the case? |
Just a thought, I think we could make use of |
I didn't know about that function. It looks like a good idea. What are your thoughts @wbamberg? |
Sorry, I haven't forgotten about this, but have had no time to properly think about it all :(. I am going to though, soon. |
Re: #528 > comment thread
@danielhickman:
@wbamberg:
The text was updated successfully, but these errors were encountered: