Created
January 25, 2019 07:17
-
-
Save dagolinuxoid/cd33092866a6293edcfd390c14278bcd to your computer and use it in GitHub Desktop.
presence of an implicit tbody in html
This file contains hidden or 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
// this code will NOT produce implicit tbody tag in your html | |
let table = document.createElement('table'); | |
let tr = document.createElement('tr'); | |
let td = document.createElement('td'); | |
td.textContent = 'table Data'; | |
table.append(tr); | |
tr.append(td); | |
document.body.append(table);</code> | |
"resultingHTML is: <table><tr><td>table Data</td></tr></table>"; | |
// this code however is going to create the implicit tbody element | |
let table = document.createElement('table'); | |
document.body.append(table); | |
table.innerHTML ="<tr><td>table Data</td></tr>" | |
"resultingHTML is : <table><tbody><tr><td>table Data</td></tr></tbody></table>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment