MCPcopy
hub / github.com/Modernizr/Modernizr / computedStyle

Function computedStyle

src/computedStyle.js:14–36  ·  view source on GitHub ↗

* wrapper around getComputedStyle, to fix issues with Firefox returning null when * called inside of a hidden iframe * * @access private * @function computedStyle * @param {HTMLElement|SVGElement} elem - The element we want to find the computed styles of * @param {string|null} [pse

(elem, pseudo, prop)

Source from the content-addressed store, hash-verified

12 * @returns {CSSStyleDeclaration} the value of the specified CSS property
13 */
14 function computedStyle(elem, pseudo, prop) {
15 var result;
16
17 if ('getComputedStyle' in window) {
18 result = getComputedStyle.call(window, elem, pseudo);
19 var console = window.console;
20
21 if (result !== null) {
22 if (prop) {
23 result = result.getPropertyValue(prop);
24 }
25 } else {
26 if (console) {
27 var method = console.error ? 'error' : 'log';
28 console[method].call(console, 'getComputedStyle returning null, its possible modernizr test results are inaccurate');
29 }
30 }
31 } else {
32 result = !pseudo && elem.currentStyle && elem.currentStyle[prop];
33 }
34
35 return result;
36 }
37
38 return computedStyle;
39});

Callers 11

bdi.jsFile · 0.85
ruby.jsFile · 0.85
vmaxunit.jsFile · 0.85
vhunit.jsFile · 0.85
vminunit.jsFile · 0.85
vwunit.jsFile · 0.85
subpixelfont.jsFile · 0.85
mq.jsFile · 0.85
nativeTestPropsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…