Home Reference Source Repository
import DOMStylesReader from 'minimap/lib/mixins/dom-styles-reader.js'
public class | source

DOMStylesReader

Extends:

mixto~Mixin → DOMStylesReader

This mixin is used by the CanvasDrawer in MinimapElement to read the styles informations from the DOM to use when rendering the Minimap.

Method Summary

Public Methods
public

Invalidates the cache by emptying the cache object.

public

retrieveStyleFromDom(scopes: Array<string>, property: string, shadowRoot: boolean, cache: boolean): string

Returns the computed values for the given property and scope in the DOM.

Public Methods

public invalidateDOMStylesCache() source

Invalidates the cache by emptying the cache object.

public retrieveStyleFromDom(scopes: Array<string>, property: string, shadowRoot: boolean, cache: boolean): string source

Returns the computed values for the given property and scope in the DOM.

This function insert a dummy element in the DOM to compute its style, return the specified property, and clear the content of the dummy element.

Params:

NameTypeAttributeDescription
scopes Array<string>

a list of classes reprensenting the scope to build

property string

the name of the style property to compute

shadowRoot boolean
  • optional
  • default: true

whether to compute the style inside a shadow DOM or not

cache boolean
  • optional
  • default: true

whether to cache the computed value or not

Return:

string

the computed property's value