mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
remove override style utility
This commit is contained in:
parent
1dc5f67685
commit
470b7477e8
1 changed files with 0 additions and 31 deletions
|
|
@ -1,31 +0,0 @@
|
||||||
// hack to configure important style attributes
|
|
||||||
// to work around this madness:
|
|
||||||
// https://github.com/Khan/aphrodite/pull/41
|
|
||||||
|
|
||||||
export default function overrideStyle (obj) {
|
|
||||||
if (obj) {
|
|
||||||
return function (ref) {
|
|
||||||
if (ref) {
|
|
||||||
for (const key in obj) {
|
|
||||||
if (null != obj[key]) {
|
|
||||||
const val = 'number' === typeof obj[key]
|
|
||||||
? `${obj[key]}px`
|
|
||||||
: String(obj[key]);
|
|
||||||
const prop = toProp(key);
|
|
||||||
ref.style.setProperty(prop, val, 'important');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// converts camelCase to camel-case
|
|
||||||
function toProp (key) {
|
|
||||||
return key.replace(
|
|
||||||
/[a-z]([A-Z])/,
|
|
||||||
(a, b) => a.substr(0, a.length - 1) + '-' + b.toLowerCase()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue