ajhsu / blog

The external storage of my brain.
3 stars 0 forks source link

jQuery's .css() method will do vendor prefixing for you #22

Open ajhsu opened 7 years ago

ajhsu commented 7 years ago

According to the official document of jQuery:

As of jQuery 1.8, the .css() setter will automatically take care of prefixing the property name. For example, take .css( "user-select", "none" ) in Chrome/Safari will set it as -webkit-user-select, Firefox will use -moz-user-select, and IE10 will use -ms-user-select.

Note that it only applies to property name but not property values. For example, using $('body').css('cursor', 'grab') will not automatically transform to .css('cursor', '-webkit-grab').