lib/client/is_visible.js
function elementAtRectPoints(element, rect) {

	var sample;

	// Get the first sample
	sample = document.elementFromPoint(rect.left, ~~rect.top);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	// Get the second sample
	sample = document.elementFromPoint(rect.left, ~~rect.bottom);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	// Get the third sample
	sample = document.elementFromPoint(rect.right, ~~rect.bottom);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	// Get the fourth sample
	sample = document.elementFromPoint(rect.right, ~~rect.top);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	return false;
}
function elementAtRectPoints(element, rect) {

	var sample;

	// Get the first sample
	sample = document.elementFromPoint(rect.left, ~~rect.top);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	// Get the second sample
	sample = document.elementFromPoint(rect.left, ~~rect.bottom);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	// Get the third sample
	sample = document.elementFromPoint(rect.right, ~~rect.bottom);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	// Get the fourth sample
	sample = document.elementFromPoint(rect.right, ~~rect.top);

	if (sample == element || isChild(element, sample)) {
		return true;
	}

	return false;
}
function elementAtRectPoints ( element , rect ) { var sample ; // Get the first sample sample = document . elementFromPoint ( rect . left , ~ ~ rect . top ) ; if ( sample == element || isChild ( element , sample ) ) { return true ; } // Get the second sample sample = document . elementFromPoint ( rect . left , ~ ~ rect . bottom ) ; if ( sample == element || isChild ( element , sample ) ) { return true ; } // Get the third sample sample = document . elementFromPoint ( rect . right , ~ ~ rect . bottom ) ; if ( sample == element || isChild ( element , sample ) ) { return true ; } // Get the fourth sample sample = document . elementFromPoint ( rect . right , ~ ~ rect . top ) ; if ( sample == element || isChild ( element , sample ) ) { return true ; } return false ; }
See if the element can be found at any of the rect's points

@author   Jelle De Loecker   <jelle@develry.be>
@since    1.2.2
@version  1.2.2

@param    {HTMLElement}   element
@param    {Object}        rect

@return   {Boolean}
See if the element can be found at any of the rect s points