Thead parsing returns null

Advertisements I have the following function: function parseMarkupToDOM(markup) { return new DOMParser().parseFromString(markup, "text/html").body.firstElementChild; } When passing most elements, it works just fine. For instance: parseMarkupToDOM(`<button>myButton</button>`); // returns a proper DOM element parseMarkupToDOM(`<h1>myHeading</h1>`); // returns a proper DOM element However, when I try to parse a thead into a DOM element, I get null: parseMarkupToDOM(` <thead>… Read More Thead parsing returns null

How to set an input in a table-header th, without increasing the column-widths?

Advertisements Here’s some table html-code, where the header-widths fit to their contents: .my-table { border: 1px solid; border-spacing: 0; table-layout: fixed; border-collapse: separate; box-sizing: border-box; } .my-table thead th { border-bottom: 1px solid ; border-right: solid 1px; } .my-table tbody td { border-top: none; border-left: none; border-bottom: 1px dotted; border-right: 1px solid; } <table class=”my-table”>… Read More How to set an input in a table-header th, without increasing the column-widths?

How to make td (table cell) height to be the same as an < a> (link element) height?

Advertisements I have created a simple example https://jsfiddle.net/9usfctbp/ that contains the issue. There is a code from fiddle: <table> <tr> <td> <a href="#"> Link </a> </td> </tr> </table> a { display: block; font-size: 16px; line-height: 16px; } Expected result: td has height 16px the same as a link. Actual result: td has height 18px that… Read More How to make td (table cell) height to be the same as an < a> (link element) height?

Python read html table from confluence and print each row as list

Advertisements I’d like to parse confuence page ,read table and create list for each row. My Table looks like My code x = confluence.get_page_by_id(p_id,expand="body.storage") soup = BeautifulSoup(x["body"]["storage"]["value"], ‘html.parser’) for tables in soup.select("table tr"): data = [item.get_text() for item in tables.select("td")] print(data) But problem is, second column becuase of the new lines output of the code… Read More Python read html table from confluence and print each row as list

How to lay an image over an image in table cell

Advertisements I’m trying to lay an image on top of an image in a table cell (if you click on it). <table> <tr> <td style="background-color:Gray;"><a id="firstcell" onclick="addImage"><img scr="snowman.png"></a></td> </tr> … </table> Here is the addImage function: function showMoves(fig_name,pos) { var image = document.createElement("img"); var imageParent = document.getElementById("firstcell"); image.src = "circle.png"; image.style.position = "absolute"; imageParent.appendChild(image); }… Read More How to lay an image over an image in table cell

Why all <tr> go in <thead> after calling a createTHead

Advertisements I have a question regarding this code: const table = document.createElement("TABLE"); const thead = table.createTHead(); const tr = thead.insertRow(); const th1 = tr.insertCell(); th1.textContent = "header1"; const th2 = tr.insertCell(); th2.textContent = "header2"; const tr2 = table.insertRow(); const td1= tr2.insertCell(); td1.textContent = "field1"; const td2 = tr2.insertCell(); td2.textContent = "field2"; document.getElementById("main").appendChild(table); All rows insert… Read More Why all <tr> go in <thead> after calling a createTHead