Created
February 13, 2019 08:23
-
-
Save dongsik-yoo/299d2da2b118fe56858f914b99cf44ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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