A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/css-regions/Region/getComputedRegionStyle below:

getComputedRegionStyle() · WebPlatform Docs

getComputedRegionStyle() Summary

Returns styles calculated for an element as it appears within a region, including styles from @region rules applied to ranges within the element.

Method of apis/css-regions/Regionapis/css-regions/Region

Syntax
var propValue = region.getComputedRegionStyle(element, pseudoElementName);
Parameters element
Data-type
DOM Node

The element that contains the desired style settings, regardless of whether it currently appears within the region.

pseudoElementName
Data-type
String

(Optional)

The name of a CSS pseudo-element (such as ::before or ::after) or a null value. Optional in WebKit-based browsers.

Return Value

Returns an object of type CSSStyleDeclarationCSSStyleDeclaration

Returns styles calculated for an element as it appears within a region, including styles from @region rules applied to ranges within the element.

Examples

Check if the formatting of an element’s property varies within a region chain

var flow = document.getNamedFlows().namedItem('sidebar');
var regions = flow.getRegions();
var contents = flow.getContent();


var pull = contents[0].querySelector('aside.pullquote')



varies = regionsVaryCSS(regions, pull, 'color');

function regionsVaryCSS(regs, elem, prop) {
    var values = {};
    var value, style;
    var count = 0;
    for (var i = 0; i < regs.length; i++) {
        value = regs[i].getComputedRegionStyle(elem).getPropertyValue(prop);
        if (! values[value]) values[value] = 0;
        values[value]++;
    }
    for (key in values) if (values.hasOwnProperty(key)) count++;
    return count;
}
Usage
 Behaves the same as getComputedStyle(), but incorporates CSS formatting from @region rules that may apply to individual regions.
Related specifications
CSS Regions Module Level 1
W3C Working Draft 28 May 2013
See also Related articles Regions External resources

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4