css-vendor
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,6 @@ | ||
## 2.0.1 / 2019-03-21 | ||
- Fix prefixing values | ||
- Update dependencies | ||
## 2.0.0 / 2019-02-11 | ||
@@ -2,0 +7,0 @@ |
@@ -13,3 +13,4 @@ 'use strict'; | ||
var css = ''; | ||
var vendor = ''; // We should not do anything if required serverside. | ||
var vendor = ''; | ||
var browser = ''; // We should not do anything if required serverside. | ||
@@ -43,2 +44,3 @@ if (isInBrowser) { | ||
css = jsCssMap.ms; | ||
browser = 'edge'; | ||
} // Correctly detect the Safari browser. | ||
@@ -54,3 +56,3 @@ | ||
* | ||
* @type {{js: String, css: String}} | ||
* @type {{js: String, css: String, vendor: String, browser: String}} | ||
* @api public | ||
@@ -63,3 +65,4 @@ */ | ||
css: css, | ||
vendor: vendor | ||
vendor: vendor, | ||
browser: browser | ||
}; | ||
@@ -503,3 +506,3 @@ | ||
// For server-side rendering. | ||
var prefixedValue = ''; | ||
var prefixedValue = value; | ||
if (!el$1) return value; // It is a string or a number as a string like '1'. | ||
@@ -509,8 +512,8 @@ // We want only prefixable values here. | ||
if (typeof value !== 'string' || !isNaN(parseInt(value, 10))) { | ||
return value; | ||
if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) { | ||
return prefixedValue; | ||
} // Create cache key for current value. | ||
var cacheKey = property + value; // Remove cache for benchmark tests or return value from cache. | ||
var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache. | ||
@@ -524,3 +527,3 @@ if (process.env.NODE_ENV !== 'benchmark' && cache$1[cacheKey] != null) { | ||
// Test value as it is. | ||
el$1.style[property] = value; | ||
el$1.style[property] = prefixedValue; | ||
} catch (err) { | ||
@@ -534,6 +537,6 @@ // Return false if value not supported. | ||
if (transitionProperties[property]) { | ||
prefixedValue = value.replace(transPropsRegExp, prefixTransitionCallback); | ||
prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback); | ||
} else if (el$1.style[property] === '') { | ||
// Value with a vendor prefix. | ||
prefixedValue = prefix.css + value; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | ||
prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | ||
@@ -553,3 +556,3 @@ if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value. | ||
cache$1[cacheKey] = value; | ||
cache$1[cacheKey] = prefixedValue; | ||
return cache$1[cacheKey]; | ||
@@ -556,0 +559,0 @@ } |
@@ -7,3 +7,4 @@ import isInBrowser from 'is-in-browser'; | ||
var css = ''; | ||
var vendor = ''; // We should not do anything if required serverside. | ||
var vendor = ''; | ||
var browser = ''; // We should not do anything if required serverside. | ||
@@ -37,2 +38,3 @@ if (isInBrowser) { | ||
css = jsCssMap.ms; | ||
browser = 'edge'; | ||
} // Correctly detect the Safari browser. | ||
@@ -48,3 +50,3 @@ | ||
* | ||
* @type {{js: String, css: String}} | ||
* @type {{js: String, css: String, vendor: String, browser: String}} | ||
* @api public | ||
@@ -57,3 +59,4 @@ */ | ||
css: css, | ||
vendor: vendor | ||
vendor: vendor, | ||
browser: browser | ||
}; | ||
@@ -497,3 +500,3 @@ | ||
// For server-side rendering. | ||
var prefixedValue = ''; | ||
var prefixedValue = value; | ||
if (!el$1) return value; // It is a string or a number as a string like '1'. | ||
@@ -503,8 +506,8 @@ // We want only prefixable values here. | ||
if (typeof value !== 'string' || !isNaN(parseInt(value, 10))) { | ||
return value; | ||
if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) { | ||
return prefixedValue; | ||
} // Create cache key for current value. | ||
var cacheKey = property + value; // Remove cache for benchmark tests or return value from cache. | ||
var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache. | ||
@@ -518,3 +521,3 @@ if (process.env.NODE_ENV !== 'benchmark' && cache$1[cacheKey] != null) { | ||
// Test value as it is. | ||
el$1.style[property] = value; | ||
el$1.style[property] = prefixedValue; | ||
} catch (err) { | ||
@@ -528,6 +531,6 @@ // Return false if value not supported. | ||
if (transitionProperties[property]) { | ||
prefixedValue = value.replace(transPropsRegExp, prefixTransitionCallback); | ||
prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback); | ||
} else if (el$1.style[property] === '') { | ||
// Value with a vendor prefix. | ||
prefixedValue = prefix.css + value; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | ||
prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | ||
@@ -547,3 +550,3 @@ if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value. | ||
cache$1[cacheKey] = value; | ||
cache$1[cacheKey] = prefixedValue; | ||
return cache$1[cacheKey]; | ||
@@ -550,0 +553,0 @@ } |
@@ -14,3 +14,4 @@ (function (global, factory) { | ||
var css = ''; | ||
var vendor = ''; // We should not do anything if required serverside. | ||
var vendor = ''; | ||
var browser = ''; // We should not do anything if required serverside. | ||
@@ -44,2 +45,3 @@ if (isBrowser) { | ||
css = jsCssMap.ms; | ||
browser = 'edge'; | ||
} // Correctly detect the Safari browser. | ||
@@ -55,3 +57,3 @@ | ||
* | ||
* @type {{js: String, css: String}} | ||
* @type {{js: String, css: String, vendor: String, browser: String}} | ||
* @api public | ||
@@ -64,3 +66,4 @@ */ | ||
css: css, | ||
vendor: vendor | ||
vendor: vendor, | ||
browser: browser | ||
}; | ||
@@ -526,3 +529,3 @@ | ||
// For server-side rendering. | ||
var prefixedValue = ''; | ||
var prefixedValue = value; | ||
if (!el$1) return value; // It is a string or a number as a string like '1'. | ||
@@ -532,8 +535,8 @@ // We want only prefixable values here. | ||
if (typeof value !== 'string' || !isNaN(parseInt(value, 10))) { | ||
return value; | ||
if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) { | ||
return prefixedValue; | ||
} // Create cache key for current value. | ||
var cacheKey = property + value; // Remove cache for benchmark tests or return value from cache. | ||
var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache. | ||
@@ -547,3 +550,3 @@ if (cache$1[cacheKey] != null) { | ||
// Test value as it is. | ||
el$1.style[property] = value; | ||
el$1.style[property] = prefixedValue; | ||
} catch (err) { | ||
@@ -557,6 +560,6 @@ // Return false if value not supported. | ||
if (transitionProperties[property]) { | ||
prefixedValue = value.replace(transPropsRegExp, prefixTransitionCallback); | ||
prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback); | ||
} else if (el$1.style[property] === '') { | ||
// Value with a vendor prefix. | ||
prefixedValue = prefix.css + value; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | ||
prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | ||
@@ -576,3 +579,3 @@ if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value. | ||
cache$1[cacheKey] = value; | ||
cache$1[cacheKey] = prefixedValue; | ||
return cache$1[cacheKey]; | ||
@@ -579,0 +582,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).cssVendor={})}(this,function(e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t="object"===("undefined"==typeof window?"undefined":r(window))&&"object"===("undefined"==typeof document?"undefined":r(document))&&9===document.nodeType,n="",o="",i="";if(t){var s={Moz:"-moz-",ms:"-ms-",O:"-o-",Webkit:"-webkit-"},u=document.createElement("p").style;for(var f in s)if(f+"Transform"in u){n=f,o=s[f];break}"Webkit"===n&&"msHyphens"in u&&(n="ms",o=s.ms),"Webkit"===n&&"-apple-trailing-word"in u&&(i="apple")}var p={js:n,css:o,vendor:i};function l(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var c={noPrefill:["appearance"],supportedProperty:function(e){return"appearance"===e&&("ms"===p.js?"-webkit-"+e:p.css+e)}},a=/[-\s]+(.)?/g;function d(e,r){return r?r.toUpperCase():""}function y(e){return e.replace(a,d)}function m(e){return y("-"+e)}var b,x={supportedProperty:function(e,r){return!!/^break-/.test(e)&&("Webkit"===p.js?"WebkitColumn"+m(e)in r&&p.css+"column-"+e:"Moz"===p.js&&("page"+m(e)in r&&"page-"+e))}},j={noPrefill:["text-decoration-skip-ink"],supportedProperty:function(e){return"text-decoration-skip-ink"===e&&("apple"===p.vendor?""+p.css+e:"Webkit"===p.js||"Moz"===p.js?e:p.css+e)}},k={noPrefill:["color-adjust"],supportedProperty:function(e){return"color-adjust"===e&&("Webkit"===p.js?p.css+"print-"+e:e)}},g={flex:"box-flex","flex-grow":"box-flex","flex-direction":["box-orient","box-direction"],order:"box-ordinal-group","align-items":"box-align","flex-flow":["box-orient","box-direction"],"justify-content":"box-pack"},v=Object.keys(g),P=function(e){return p.css+e},w={"flex-grow":"flex-positive","flex-shrink":"flex-negative","flex-basis":"flex-preferred-size","justify-content":"flex-pack",order:"flex-order","align-items":"flex-align","align-content":"flex-line-pack"},h=[c,{noPrefill:["transform"],supportedProperty:function(e,r,t){return"transform"===e&&(t.transform?e:p.css+e)}},{noPrefill:["transition"],supportedProperty:function(e,r,t){return"transition"===e&&(t.transition?e:p.css+e)}},{noPrefill:["mask"],supportedProperty:function(e,r){if(!/^mask/.test(e))return!1;if("Webkit"===p.js){if(y("mask-image")in r)return e;if(p.js+m("mask-image")in r)return p.css+e}return e}},{noPrefill:["writing-mode"],supportedProperty:function(e){return"writing-mode"===e&&("Webkit"===p.js||"ms"===p.js?p.css+e:e)}},k,j,x,{supportedProperty:function(e,r){if(!/^(border|margin|padding)-inline/.test(e))return!1;if("Moz"===p.js)return e;var t=e.replace("-inline","");return p.js+m(t)in r&&p.css+t}},{supportedProperty:function(e,r){return y(e)in r&&e}},{supportedProperty:function(e,r){var t=m(e);return p.js+t in r?p.css+e:"Webkit"!==p.js&&"Webkit"+t in r&&e}},{supportedProperty:function(e){return"scroll-snap"===e.substring(0,11)&&("ms"===p.js?""+p.css+e:e)}},{supportedProperty:function(e){return"overscroll-behavior"===e&&("ms"===p.js?p.css+"scroll-chaining":e)}},{supportedProperty:function(e,r){var t=w[e];return!!t&&(p.js+m(t)in r&&p.css+t)}},{supportedProperty:function(e,r,t){var n=t.multiple;if(v.indexOf(e)>-1){var o=g[e];if(!Array.isArray(o))return p.js+m(o)in r&&p.css+o;if(!n)return!1;for(var i=0;i<o.length;i++)if(!(p.js+m(o[0])in r))return!1;return o.map(P)}return!1}}],W=h.filter(function(e){return e.supportedProperty}).map(function(e){return e.supportedProperty}),S=h.filter(function(e){return e.noPrefill}).reduce(function(e,r){return e.push.apply(e,l(r.noPrefill)),e},[]),A={};if(t){b=document.createElement("p");var z=window.getComputedStyle(document.documentElement,"");for(var E in z)isNaN(E)||(A[z[E]]=z[E]);S.forEach(function(e){return delete A[e]})}function O(e,r){if(void 0===r&&(r={}),!b)return e;if(null!=A[e])return A[e];"transition"!==e&&"transform"!==e||(r[e]=e in b.style);for(var t=0;t<W.length&&(A[e]=W[t](e,b.style,r),!A[e]);t++);try{b.style[e]=""}catch(e){return!1}return A[e]}var M,N={},C={transition:1,"transition-property":1,"-webkit-transition":1,"-webkit-transition-property":1},T=/(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;function I(e,r,t){return"all"===r?"all":"all"===t?", all":r?O(r):", "+O(t)}t&&(M=document.createElement("p")),e.prefix=p,e.supportedKeyframes=function(e){return"-"===e[1]?e:"ms"===p.js?e:"@"+p.css+"keyframes"+e.substr(10)},e.supportedProperty=O,e.supportedValue=function(e,r){var t="";if(!M)return r;if("string"!=typeof r||!isNaN(parseInt(r,10)))return r;var n=e+r;if(null!=N[n])return N[n];try{M.style[e]=r}catch(e){return N[n]=!1,!1}if(C[e])t=r.replace(T,I);else if(""===M.style[e]&&("-ms-flex"===(t=p.css+r)&&(M.style[e]="-ms-flexbox"),M.style[e]=t,""===M.style[e]))return N[n]=!1,!1;return M.style[e]="",N[n]=r,N[n]},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).cssVendor={})}(this,function(e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t="object"===("undefined"==typeof window?"undefined":r(window))&&"object"===("undefined"==typeof document?"undefined":r(document))&&9===document.nodeType,n="",o="",i="",s="";if(t){var u={Moz:"-moz-",ms:"-ms-",O:"-o-",Webkit:"-webkit-"},f=document.createElement("p").style;for(var p in u)if(p+"Transform"in f){n=p,o=u[p];break}"Webkit"===n&&"msHyphens"in f&&(n="ms",o=u.ms,s="edge"),"Webkit"===n&&"-apple-trailing-word"in f&&(i="apple")}var l={js:n,css:o,vendor:i,browser:s};function c(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var a={noPrefill:["appearance"],supportedProperty:function(e){return"appearance"===e&&("ms"===l.js?"-webkit-"+e:l.css+e)}},d=/[-\s]+(.)?/g;function y(e,r){return r?r.toUpperCase():""}function m(e){return e.replace(d,y)}function b(e){return m("-"+e)}var x,j={supportedProperty:function(e,r){return!!/^break-/.test(e)&&("Webkit"===l.js?"WebkitColumn"+b(e)in r&&l.css+"column-"+e:"Moz"===l.js&&("page"+b(e)in r&&"page-"+e))}},g={noPrefill:["text-decoration-skip-ink"],supportedProperty:function(e){return"text-decoration-skip-ink"===e&&("apple"===l.vendor?""+l.css+e:"Webkit"===l.js||"Moz"===l.js?e:l.css+e)}},k={noPrefill:["color-adjust"],supportedProperty:function(e){return"color-adjust"===e&&("Webkit"===l.js?l.css+"print-"+e:e)}},v={flex:"box-flex","flex-grow":"box-flex","flex-direction":["box-orient","box-direction"],order:"box-ordinal-group","align-items":"box-align","flex-flow":["box-orient","box-direction"],"justify-content":"box-pack"},P=Object.keys(v),w=function(e){return l.css+e},h={"flex-grow":"flex-positive","flex-shrink":"flex-negative","flex-basis":"flex-preferred-size","justify-content":"flex-pack",order:"flex-order","align-items":"flex-align","align-content":"flex-line-pack"},W=[a,{noPrefill:["transform"],supportedProperty:function(e,r,t){return"transform"===e&&(t.transform?e:l.css+e)}},{noPrefill:["transition"],supportedProperty:function(e,r,t){return"transition"===e&&(t.transition?e:l.css+e)}},{noPrefill:["mask"],supportedProperty:function(e,r){if(!/^mask/.test(e))return!1;if("Webkit"===l.js){if(m("mask-image")in r)return e;if(l.js+b("mask-image")in r)return l.css+e}return e}},{noPrefill:["writing-mode"],supportedProperty:function(e){return"writing-mode"===e&&("Webkit"===l.js||"ms"===l.js?l.css+e:e)}},k,g,j,{supportedProperty:function(e,r){if(!/^(border|margin|padding)-inline/.test(e))return!1;if("Moz"===l.js)return e;var t=e.replace("-inline","");return l.js+b(t)in r&&l.css+t}},{supportedProperty:function(e,r){return m(e)in r&&e}},{supportedProperty:function(e,r){var t=b(e);return l.js+t in r?l.css+e:"Webkit"!==l.js&&"Webkit"+t in r&&e}},{supportedProperty:function(e){return"scroll-snap"===e.substring(0,11)&&("ms"===l.js?""+l.css+e:e)}},{supportedProperty:function(e){return"overscroll-behavior"===e&&("ms"===l.js?l.css+"scroll-chaining":e)}},{supportedProperty:function(e,r){var t=h[e];return!!t&&(l.js+b(t)in r&&l.css+t)}},{supportedProperty:function(e,r,t){var n=t.multiple;if(P.indexOf(e)>-1){var o=v[e];if(!Array.isArray(o))return l.js+b(o)in r&&l.css+o;if(!n)return!1;for(var i=0;i<o.length;i++)if(!(l.js+b(o[0])in r))return!1;return o.map(w)}return!1}}],S=W.filter(function(e){return e.supportedProperty}).map(function(e){return e.supportedProperty}),A=W.filter(function(e){return e.noPrefill}).reduce(function(e,r){return e.push.apply(e,c(r.noPrefill)),e},[]),z={};if(t){x=document.createElement("p");var E=window.getComputedStyle(document.documentElement,"");for(var O in E)isNaN(O)||(z[E[O]]=E[O]);A.forEach(function(e){return delete z[e]})}function M(e,r){if(void 0===r&&(r={}),!x)return e;if(null!=z[e])return z[e];"transition"!==e&&"transform"!==e||(r[e]=e in x.style);for(var t=0;t<S.length&&(z[e]=S[t](e,x.style,r),!z[e]);t++);try{x.style[e]=""}catch(e){return!1}return z[e]}var N,C={},T={transition:1,"transition-property":1,"-webkit-transition":1,"-webkit-transition-property":1},I=/(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;function V(e,r,t){return"all"===r?"all":"all"===t?", all":r?M(r):", "+M(t)}t&&(N=document.createElement("p")),e.prefix=l,e.supportedKeyframes=function(e){return"-"===e[1]?e:"ms"===l.js?e:"@"+l.css+"keyframes"+e.substr(10)},e.supportedProperty=M,e.supportedValue=function(e,r){var t=r;if(!N)return r;if("string"!=typeof t||!isNaN(parseInt(t,10)))return t;var n=e+t;if(null!=C[n])return C[n];try{N.style[e]=t}catch(e){return C[n]=!1,!1}if(T[e])t=t.replace(I,V);else if(""===N.style[e]&&("-ms-flex"===(t=l.css+t)&&(N.style[e]="-ms-flexbox"),N.style[e]=t,""===N.style[e]))return C[n]=!1,!1;return N.style[e]="",C[n]=t,C[n]},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "css-vendor", | ||
"description": "CSS vendor prefix detection and property feature testing.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": { | ||
@@ -46,3 +46,3 @@ "name": "Oleg Slobodskoi", | ||
"@babel/preset-env": "^7.2.3", | ||
"autoprefixer": "^9.4.7", | ||
"autoprefixer": "^9.5.0", | ||
"babel-cli": "^6.5.1", | ||
@@ -55,3 +55,3 @@ "babel-eslint": "^9.0.0", | ||
"babel-plugin-transform-es3-property-literals": "^6.8.0", | ||
"caniuse-support": "^0.4.3", | ||
"caniuse-support": "^1.0.1", | ||
"cross-env": "^5.2.0", | ||
@@ -63,3 +63,3 @@ "es5-shim": "^4.5.10", | ||
"expect.js": "^0.3.1", | ||
"karma": "^3.1.4", | ||
"karma": "^4.0.1", | ||
"karma-benchmark": "^1.0.0", | ||
@@ -77,3 +77,3 @@ "karma-benchmark-reporter": "^0.1.1", | ||
"lint-staged": "^8.0.5", | ||
"mocha": "^5.2.0", | ||
"mocha": "^6.0.0", | ||
"postcss-js": "^2.0.0", | ||
@@ -80,0 +80,0 @@ "pre-commit": "^1.1.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57868
1368