forked from yuanyan/barium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// based on react-kit/getVendorPrefix | ||
|
||
let cssVendorPrefix; | ||
|
||
export default () => { | ||
|
||
if (cssVendorPrefix) { | ||
return cssVendorPrefix; | ||
} | ||
|
||
if (!(window && document)) { | ||
return ''; | ||
} | ||
|
||
let styles = window.getComputedStyle(document.documentElement, ''); | ||
let pre = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']))[1]; | ||
|
||
return cssVendorPrefix = `-${pre}-`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// based on react-kit/getVendorPropertyName | ||
|
||
let builtinStyle = document ? document.createElement('div').style : null; | ||
let prefixes = ['Moz', 'Webkit', 'O', 'ms']; | ||
let domVendorPrefix; | ||
|
||
// Helper function to get the proper vendor property name. (transition => WebkitTransition) | ||
export default (prop, isSupportTest) => { | ||
if (!document) { | ||
return ''; | ||
} | ||
|
||
let vendorProp; | ||
if (prop in builtinStyle) return prop; | ||
|
||
let UpperProp = prop.charAt(0).toUpperCase() + prop.substr(1); | ||
|
||
if (domVendorPrefix) { | ||
|
||
vendorProp = domVendorPrefix + UpperProp; | ||
if (vendorProp in builtinStyle) { | ||
return vendorProp; | ||
} | ||
} else { | ||
|
||
for (let i = 0; i < prefixes.length; ++i) { | ||
vendorProp = prefixes[i] + UpperProp; | ||
if (vendorProp in builtinStyle) { | ||
domVendorPrefix = prefixes[i]; | ||
return vendorProp; | ||
} | ||
} | ||
} | ||
|
||
// if support test, not fallback to origin prop name | ||
if (!isSupportTest) { | ||
return prop; | ||
} | ||
|
||
} |