Skip to content

Commit

Permalink
Add support for SSR or pjax (prevent multiple transformations)
Browse files Browse the repository at this point in the history
  • Loading branch information
bleistivt committed Apr 29, 2021
1 parent 2cf9077 commit 05bc249
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mobileTable.js
Expand Up @@ -217,7 +217,7 @@ window.mobileTables = ((options) => {
let mutation = false

for (let table of tables) {
if (tableMap.has(table)) {
if (tableMap.has(table) || table.classList.has("mobiletable-transformed")) {
return
}

Expand All @@ -231,6 +231,8 @@ window.mobileTables = ((options) => {
tableMap.set(mobile, table)
dummy.replaceWith(mobile)

table.classList.add("mobiletable-transformed")

mutation = true
}

Expand Down Expand Up @@ -264,6 +266,8 @@ window.mobileTables = ((options) => {

dummy.replaceWith(original)

table.classList.remove("mobiletable-transformed")

mutation = true
}

Expand Down

0 comments on commit 05bc249

Please sign in to comment.