function(oControl) {
			var sContentDensity;
			var aContentDensityStyleClasses = ["sapUiSizeCondensed", "sapUiSizeCompact", "sapUiSizeCozy"];

			var fnGetContentDensity = function(sFnName, oObject) {
				if (!oObject[sFnName]) {
					return;
				}

				for (var i = 0; i < aContentDensityStyleClasses.length; i++) {
					if (oObject[sFnName](aContentDensityStyleClasses[i])) {
						return aContentDensityStyleClasses[i];
					}
				}
			};

			var $DomRef = oControl.$();
			if ($DomRef.length > 0) {
				// table was already rendered, check by DOM and return content density class
				sContentDensity = fnGetContentDensity("hasClass", $DomRef);
			} else {
				sContentDensity = fnGetContentDensity("hasStyleClass", oControl);
			}

			if (sContentDensity) {
				return sContentDensity;
			}

			// since the table was not yet rendered, traverse its parents:
			//   - to find a content density defined at control level
			//   - to find the first DOM reference and then check on DOM level
			var oParentDomRef = null;
			var oParent = oControl.getParent();
			// the table might not have a parent at all.
			if (oParent) {
				// try to get the DOM Ref of the parent. It might be required to traverse the complete parent
				// chain to find one parent which has DOM rendered, as it may happen that an element does not have
				// a corresponding DOM Ref
				do {
					// if the content density is defined at control level, we can return it, no matter the control was already
					// rendered. By the time it will be rendered, it will have that style class
					sContentDensity = fnGetContentDensity("hasStyleClass", oParent);
					if (sContentDensity) {
						return sContentDensity;
					}

					// if there was no style class set at control level, we try to find the DOM reference. Using that
					// DOM reference, we can easily check for the content density style class via the DOM. This allows us
					// to include e.g. the body tag as well.
					if (oParent.getDomRef) {
						// for Controls and elements
						oParentDomRef = oParent.getDomRef();
					} else if (oParent.getRootNode) {
						// for UIArea
						oParentDomRef = oParent.getRootNode();
					}

					if (!oParentDomRef && oParent.getParent) {
						oParent = oParent.getParent();
					} else {
						// make sure there is not endless loop if oParent has no getParent function
						oParent = null;
					}
				} while (oParent && !oParentDomRef);
			}

			// if we found a DOM reference, check for content density
			$DomRef = jQuery(oParentDomRef || document.body);
			sContentDensity = fnGetContentDensity("hasClass", $DomRef.closest("." + aContentDensityStyleClasses.join(",.")));

			return sContentDensity;
		}
function(oControl) {
			var sContentDensity;
			var aContentDensityStyleClasses = ["sapUiSizeCondensed", "sapUiSizeCompact", "sapUiSizeCozy"];

			var fnGetContentDensity = function(sFnName, oObject) {
				if (!oObject[sFnName]) {
					return;
				}

				for (var i = 0; i < aContentDensityStyleClasses.length; i++) {
					if (oObject[sFnName](aContentDensityStyleClasses[i])) {
						return aContentDensityStyleClasses[i];
					}
				}
			};

			var $DomRef = oControl.$();
			if ($DomRef.length > 0) {
				// table was already rendered, check by DOM and return content density class
				sContentDensity = fnGetContentDensity("hasClass", $DomRef);
			} else {
				sContentDensity = fnGetContentDensity("hasStyleClass", oControl);
			}

			if (sContentDensity) {
				return sContentDensity;
			}

			// since the table was not yet rendered, traverse its parents:
			//   - to find a content density defined at control level
			//   - to find the first DOM reference and then check on DOM level
			var oParentDomRef = null;
			var oParent = oControl.getParent();
			// the table might not have a parent at all.
			if (oParent) {
				// try to get the DOM Ref of the parent. It might be required to traverse the complete parent
				// chain to find one parent which has DOM rendered, as it may happen that an element does not have
				// a corresponding DOM Ref
				do {
					// if the content density is defined at control level, we can return it, no matter the control was already
					// rendered. By the time it will be rendered, it will have that style class
					sContentDensity = fnGetContentDensity("hasStyleClass", oParent);
					if (sContentDensity) {
						return sContentDensity;
					}

					// if there was no style class set at control level, we try to find the DOM reference. Using that
					// DOM reference, we can easily check for the content density style class via the DOM. This allows us
					// to include e.g. the body tag as well.
					if (oParent.getDomRef) {
						// for Controls and elements
						oParentDomRef = oParent.getDomRef();
					} else if (oParent.getRootNode) {
						// for UIArea
						oParentDomRef = oParent.getRootNode();
					}

					if (!oParentDomRef && oParent.getParent) {
						oParent = oParent.getParent();
					} else {
						// make sure there is not endless loop if oParent has no getParent function
						oParent = null;
					}
				} while (oParent && !oParentDomRef);
			}

			// if we found a DOM reference, check for content density
			$DomRef = jQuery(oParentDomRef || document.body);
			sContentDensity = fnGetContentDensity("hasClass", $DomRef.closest("." + aContentDensityStyleClasses.join(",.")));

			return sContentDensity;
		}
function ( oControl ) { var sContentDensity ; var aContentDensityStyleClasses = [ "sapUiSizeCondensed" , "sapUiSizeCompact" , "sapUiSizeCozy" ] ; var fnGetContentDensity = function ( sFnName , oObject ) { if ( ! oObject [ sFnName ] ) { return ; } for ( var i = 0 ; i < aContentDensityStyleClasses . length ; i ++ ) { if ( oObject [ sFnName ] ( aContentDensityStyleClasses [ i ] ) ) { return aContentDensityStyleClasses [ i ] ; } } } ; var $DomRef = oControl . $ ( ) ; if ( $DomRef . length > 0 ) { // table was already rendered, check by DOM and return content density class sContentDensity = fnGetContentDensity ( "hasClass" , $DomRef ) ; } else { sContentDensity = fnGetContentDensity ( "hasStyleClass" , oControl ) ; } if ( sContentDensity ) { return sContentDensity ; } // since the table was not yet rendered, traverse its parents: //   - to find a content density defined at control level //   - to find the first DOM reference and then check on DOM level var oParentDomRef = null ; var oParent = oControl . getParent ( ) ; // the table might not have a parent at all. if ( oParent ) { // try to get the DOM Ref of the parent. It might be required to traverse the complete parent // chain to find one parent which has DOM rendered, as it may happen that an element does not have // a corresponding DOM Ref do { // if the content density is defined at control level, we can return it, no matter the control was already // rendered. By the time it will be rendered, it will have that style class sContentDensity = fnGetContentDensity ( "hasStyleClass" , oParent ) ; if ( sContentDensity ) { return sContentDensity ; } // if there was no style class set at control level, we try to find the DOM reference. Using that // DOM reference, we can easily check for the content density style class via the DOM. This allows us // to include e.g. the body tag as well. if ( oParent . getDomRef ) { // for Controls and elements oParentDomRef = oParent . getDomRef ( ) ; } else if ( oParent . getRootNode ) { // for UIArea oParentDomRef = oParent . getRootNode ( ) ; } if ( ! oParentDomRef && oParent . getParent ) { oParent = oParent . getParent ( ) ; } else { // make sure there is not endless loop if oParent has no getParent function oParent = null ; } } while ( oParent && ! oParentDomRef ) ; } // if we found a DOM reference, check for content density $DomRef = jQuery ( oParentDomRef || document . body ) ; sContentDensity = fnGetContentDensity ( "hasClass" , $DomRef . closest ( "." + aContentDensityStyleClasses . join ( ",." ) ) ) ; return sContentDensity ; }
Returns the content density style class which is relevant for the given control. First it tries to find the
definition via the control API. While traversing the controls parents, it's tried to find the closest DOM
reference. If that is found, the check will use the DOM reference to find the closest content density style class
in the parent chain. This approach caters both use cases: content density defined at DOM and/or control level.

If at the same level, several style classes are defined, this is the priority:
sapUiSizeCompact, sapUiSizeCondensed, sapUiSizeCozy

@param {sap.ui.table.Table} oControl Instance of the table.
@returns {String | undefined} name of the content density style class or undefined if none was found.
Returns the content density style class which is relevant for the given control . First it tries to find the definition via the control API . While traversing the controls parents it s tried to find the closest DOM reference . If that is found the check will use the DOM reference to find the closest content density style class in the parent chain . This approach caters both use cases : content density defined at DOM and / or control level .
Returns the content density of the given control