Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TABLE/THEAD/TBODY/TR as element to not consider blank #276

Closed
LinFeng1997 opened this issue Mar 6, 2019 · 2 comments · Fixed by #326
Closed

Add TABLE/THEAD/TBODY/TR as element to not consider blank #276

LinFeng1997 opened this issue Mar 6, 2019 · 2 comments · Fixed by #326

Comments

@LinFeng1997
Copy link

For Example:

<table>
    <thead>
        <tr>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>content</td>
        </tr>
    </tbody>
</table>

will to be:

| content |

I hope this:

|  |
|--- |
| content |
@LinFeng1997
Copy link
Author

solution:

function isBlank (node) {
  return (
    ['A','TABLE','THEAD','TBODY','TR','TH', 'TD', 'IFRAME', 'SCRIPT', 'AUDIO', 'VIDEO'].indexOf(node.nodeName) === -1 &&
    /^\s*$/i.test(node.textContent) &&
    !isVoid(node) &&
    !hasVoid(node)
  )
}

@jalbertbowden
Copy link

jalbertbowden commented May 12, 2019

don't forget caption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants