Skip to content

Instantly share code, notes, and snippets.

@dongsik-yoo
Created February 13, 2019 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongsik-yoo/299d2da2b118fe56858f914b99cf44ea to your computer and use it in GitHub Desktop.
Save dongsik-yoo/299d2da2b118fe56858f914b99cf44ea to your computer and use it in GitHub Desktop.
/**
* Find a first exceed paragraph
* @param {HTMLElement} pageBodyElement - page body element
* @param {number} pageBodyBottom - page bottom
* @returns {HtmlElement} a first exceed paragraph
*/
_findExceedParagraph(pageBodyElement, pageBodyBottom) {
const paragraphs = pageBodyElement.querySelectorAll('p');
const {length} = paragraphs;
for (let i = 0; i < length; i += 1) {
const paragraph = paragraphs[i];
const paragraphBottom = this._getBottom(paragraph);
if (pageBodyBottom < paragraphBottom) {
return paragraph;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment