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
Syntaxvar propValue = region.getComputedRegionStyle(element, pseudoElementName);
Parameters element
The element that contains the desired style settings, regardless of whether it currently appears within the region.
pseudoElementName(Optional)
The name of a CSS pseudo-element (such as ::before or ::after) or a null value. Optional in WebKit-based browsers.
Return ValueReturns 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.
ExamplesCheck 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
getComputedRegionStyle()
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