first commit
This commit is contained in:
26
frontend/node_modules/rc-util/es/Dom/styleChecker.js
generated
vendored
Normal file
26
frontend/node_modules/rc-util/es/Dom/styleChecker.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import canUseDom from "./canUseDom";
|
||||
var isStyleNameSupport = function isStyleNameSupport(styleName) {
|
||||
if (canUseDom() && window.document.documentElement) {
|
||||
var styleNameList = Array.isArray(styleName) ? styleName : [styleName];
|
||||
var documentElement = window.document.documentElement;
|
||||
return styleNameList.some(function (name) {
|
||||
return name in documentElement.style;
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var isStyleValueSupport = function isStyleValueSupport(styleName, value) {
|
||||
if (!isStyleNameSupport(styleName)) {
|
||||
return false;
|
||||
}
|
||||
var ele = document.createElement('div');
|
||||
var origin = ele.style[styleName];
|
||||
ele.style[styleName] = value;
|
||||
return ele.style[styleName] !== origin;
|
||||
};
|
||||
export function isStyleSupport(styleName, styleValue) {
|
||||
if (!Array.isArray(styleName) && styleValue !== undefined) {
|
||||
return isStyleValueSupport(styleName, styleValue);
|
||||
}
|
||||
return isStyleNameSupport(styleName);
|
||||
}
|
||||
Reference in New Issue
Block a user