MCPcopy
hub / github.com/react-component/form / computedStyle

Function computedStyle

src/createDOMForm.js:8–32  ·  view source on GitHub ↗
(el, prop)

Source from the content-addressed store, hash-verified

6import { getParams } from './utils';
7
8function computedStyle(el, prop) {
9 const getComputedStyle = window.getComputedStyle;
10 const style =
11 // If we have getComputedStyle
12 getComputedStyle ?
13 // Query it
14 // TODO: From CSS-Query notes, we might need (node, null) for FF
15 getComputedStyle(el) :
16
17 // Otherwise, we are in IE and use currentStyle
18 el.currentStyle;
19 if (style) {
20 return style
21 [
22 // Switch to camelCase for CSSOM
23 // DEV: Grabbed from jQuery
24 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
25 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
26 prop.replace(/-(\w)/gi, (word, letter) => {
27 return letter.toUpperCase();
28 })
29 ];
30 }
31 return undefined;
32}
33
34function getScrollableContainer(n) {
35 let node = n;

Callers 1

getScrollableContainerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected