1 | import canUseDom from "./canUseDom";
|
2 | var isStyleNameSupport = function isStyleNameSupport(styleName) {
|
3 | if (canUseDom() && window.document.documentElement) {
|
4 | var styleNameList = Array.isArray(styleName) ? styleName : [styleName];
|
5 | var documentElement = window.document.documentElement;
|
6 | return styleNameList.some(function (name) {
|
7 | return name in documentElement.style;
|
8 | });
|
9 | }
|
10 | return false;
|
11 | };
|
12 | var isStyleValueSupport = function isStyleValueSupport(styleName, value) {
|
13 | if (!isStyleNameSupport(styleName)) {
|
14 | return false;
|
15 | }
|
16 | var ele = document.createElement('div');
|
17 | var origin = ele.style[styleName];
|
18 | ele.style[styleName] = value;
|
19 | return ele.style[styleName] !== origin;
|
20 | };
|
21 | export function isStyleSupport(styleName, styleValue) {
|
22 | if (!Array.isArray(styleName) && styleValue !== undefined) {
|
23 | return isStyleValueSupport(styleName, styleValue);
|
24 | }
|
25 | return isStyleNameSupport(styleName);
|
26 | } |
\ | No newline at end of file |