firstEmptyRegionIndex

Jump to: navigation, search

firstEmptyRegionIndex

This page has been flagged with the following issues:

High-level issues:


W3C Editor's Draft

Summary

Returns the integer index of the first empty element within a region chain. Returns -1 if the content fits within the region chain or if it exceeds available space.

Property of apis/css-regions/NamedFlow

Syntax

Note: This property is read-only.

var index = flow.firstEmptyRegionIndex;

Return Value

Returns an object of type Number.

Returns the integer index of the first empty element within a region chain. Returns -1 if the content fits within the region chain or if it exceeds available space.

Examples

JavaScript

trimRegions('mainFlow');

// deletes any empty regions from the end of a flow:
function trimRegions(flowName) {
    var flow = document.getNamedFlows().namedItem(flowName);
    var index = flow.firstEmptyRegionIndex;
    var regions = flow.getRegions();
    if (index == -1) return(false); // no empty regions?
    // remove first empty region & all thereafter:
    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

Specification Status Related Changes
CSS Regions Module Level 3 W3C Editor's Draft

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support
20 -webkit
Unsupported
Unsupported
Unsupported
534 -webkit

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic Support Unsupported
Unsupported
Unsupported
Unsupported
Unsupported
Unsupported
Unsupported
Unsupported

See also

Related articles

Regions




  • firstEmptyRegionIndex






























External resources