From 3316d412f92a2f70a2afe06abd849972c54944a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C2=A1ke?= <77801554+front42@users.noreply.github.com> Date: Fri, 16 Jan 2026 16:08:57 +0300 Subject: [PATCH 1/2] feat: update sort-table solution.md en --- .../07-modifying-document/12-sort-table/solution.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2-ui/1-document/07-modifying-document/12-sort-table/solution.md b/2-ui/1-document/07-modifying-document/12-sort-table/solution.md index 49243e8e39..ac9c7c3262 100644 --- a/2-ui/1-document/07-modifying-document/12-sort-table/solution.md +++ b/2-ui/1-document/07-modifying-document/12-sort-table/solution.md @@ -2,9 +2,9 @@ The solution is short, yet may look a bit tricky, so here I provide it with exte ```js let sortedRows = Array.from(table.tBodies[0].rows) // 1 - .sort((rowA, rowB) => rowA.cells[0].innerHTML.localeCompare(rowB.cells[0].innerHTML)); + .sort((rowA, rowB) => rowA.cells[0].textContent.trim().localeCompare(rowB.cells[0].textContent.trim())); // 2 -table.tBodies[0].append(...sortedRows); // (3) +table.tBodies[0].append(...sortedRows); // 3 ``` The step-by-step algorthm: @@ -15,4 +15,4 @@ The step-by-step algorthm: We don't have to remove row elements, just "re-insert", they leave the old place automatically. -P.S. In our case, there's an explicit `` in the table, but even if HTML table doesn't have ``, the DOM structure always has it. +Tables always have an implicit `` element, so we need to get it and insert into it: a simple `table.append(...)` will fail. From 24cc17a029e78303e4c405d98a6bf716152e761f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C2=A1ke?= <77801554+front42@users.noreply.github.com> Date: Fri, 16 Jan 2026 16:18:32 +0300 Subject: [PATCH 2/2] feat: update sort-table solution.view index.html --- .../12-sort-table/solution.view/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/1-document/07-modifying-document/12-sort-table/solution.view/index.html b/2-ui/1-document/07-modifying-document/12-sort-table/solution.view/index.html index 40692031a1..d224fc7fbb 100644 --- a/2-ui/1-document/07-modifying-document/12-sort-table/solution.view/index.html +++ b/2-ui/1-document/07-modifying-document/12-sort-table/solution.view/index.html @@ -24,7 +24,7 @@