MCPcopy
hub / github.com/webpack/webpack / getComputedStyle

Method getComputedStyle

test/helpers/FakeDocument.js:153–166  ·  view source on GitHub ↗

* @param {FakeElement} element element * @returns {StyleDeclaration} computed style

(element)

Source from the content-addressed store, hash-verified

151 * @returns {StyleDeclaration} computed style
152 */
153 getComputedStyle(element) {
154 /** @type {StyleDeclaration} */
155 const style = { getPropertyValue };
156 const links = this.getElementsByTagName("link");
157 for (const link of links) {
158 if (!link.sheet) continue;
159 for (const rule of link.sheet.cssRules) {
160 if (rule.selectorText === element._type) {
161 Object.assign(style, rule.style);
162 }
163 }
164 }
165 return style;
166 }
167}
168
169class FakeElement {

Callers

nothing calls this directly

Calls 1

getElementsByTagNameMethod · 0.95

Tested by

no test coverage detected