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/NamedFlow/firstEmptyRegionIndex below:

firstEmptyRegionIndex · WebPlatform Docs

firstEmptyRegionIndex Summary

Returns the integer index of the first empty element within a region chain. Returns -1 if the content fits within the region chain, if it exceeds available space or if there are no regions in the region chain.

Property of apis/css-regions/NamedFlowapis/css-regions/NamedFlow

Syntax

Note: This property is read-only.

var index = flow.firstEmptyRegionIndex;
Return Value

Returns an object of type NumberNumber

Returns the integer index of the first empty element within a region chain. Returns -1 if the content fits within the region chain, if it exceeds available space or if there are no regions in the region chain.

Examples
trimRegions('mainFlow');


function trimRegions(flowName) {
    var flow = document.getNamedFlows().namedItem(flowName);
    var index = flow.firstEmptyRegionIndex;
    var regions = flow.getRegions();
    if (index == -1) return(false); 
    
    for (var i = index; i < regions.length; i++) {
        regions[i].parentNode.removeChild(regions[i]);
    }
    return(true);
}
Usage
 The firstEmptyRegionIndex is the index of the first

region within the flow’s getRegions() collection whose regionOverset is empty. If all are set to fit or overset, or if no regions are associated with the flow, the firstEmptyRegionIndex returns -1.

Related specifications
CSS Regions Module Level 1
W3C Working Draft
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