F
F
fajjet2015-09-11 15:40:27
JavaScript
fajjet, 2015-09-11 15:40:27

Is there such a script that determines if the browser supports a certain property and adds prefixes?

Let's say there is a controversial css property transform. There are simply too many places where this property pops up. The point is speed. Why do users with modern browsers need unnecessary prefixes when just the name "transform" will do. Here the script should check whether the browser supports a certain css property, if not, then it adds the necessary prefix. If yes, then it adds nothing))) Somewhere I saw this script. Maybe someone knows))) It is in the javascript code itself, not css. So that there are no unnecessary questions, what does the script do. It checks once whether the browser supports transform and, if not, adds the necessary prefix to all transforms in the JAVASCRIPT file. It is in js. Not css. There is no way to change classes if someone wants to suggest the "best option". The value is calculated.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Moses Fender, 2019-04-09
@sljfhwo

I will assume that ctx is created before the #canvas element appears in the DOM.
Well, there is no onmousedown event, there is mousedown.

S
Sergey, 2015-09-11
Protko @Fesor

Now think about those poor bastards who, in addition to using flawed browsers, also have to process the CSS for every request to your site. And for what? so that users of normal browsers could save half a kilobyte. gzip eliminates a bunch of duplication in css and the difference in terms of css parsing time is negligible.
So we pick up autoprefixer and do precompilation on the server, + serve in gzip + caching.
--- updated ---
Sorry, I messed up with transform in css files.
I can’t offer anything for js, only this:
www.kirupa.com/html5/vendor_prefixes_javascript.htm

K
Kirill Kublyakov, 2015-09-11
@Kublyakov

  1. https://github.com/postcss/postcss , it includes autoprefier, which is exactly what you need.
  2. You can also use the modernizr.com library , it detects the capabilities of the browser and adds a specific class to the html tag. If the browser does not support transform, then the "no-transform" class will be added and it will be possible to write a fallback in normal css.

T
trueClearThinker, 2015-09-11
@trueClearThinker

Why do you think the script will run faster than the CSS will be processed?

M
Mikhail Osher, 2015-09-11
@miraage

Absolute nonsense.
The only normal solution is to write css (bonus for preprocessors) + autoprefixer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question