Skip to content
Permalink
Browse files

Refactor responsive table markup to be valid HTML

  • Loading branch information
Teemu Suoranta
Teemu Suoranta committed Apr 4, 2019
1 parent cc8f6d2 commit f3de438deea9342ae0548233bb078a25a38c8661
@@ -1,5 +1,5 @@
{
"js": 1554364218413,
"css": 1554364838083,
"js": 1554373157703,
"css": 1554373327412,
"svg": 1554364154832
}
@@ -16,15 +16,16 @@ var responsive_tables_in_content = function() {

// create new wrapper
var wrapper = document.createElement('div');
wrapper.setAttribute('class', 'wp-block-table__wrapper');

// wrap all children
while(tables[i].firstChild) {
wrapper.appendChild(tables[i].firstChild);
}
// take all classes from table
wrapper.setAttribute('class', tables[i].getAttribute('class'));

// reset table classes
tables[i].removeAttribute('class');

// append new wrapper
tables[i].appendChild(wrapper);
// wrap the table
tables[i].parentNode.insertBefore(wrapper, tables[i]);
wrapper.appendChild(tables[i]);

}
}
@@ -88,6 +88,11 @@
}
}

&.alignwide,
&.alignfull {
margin-bottom: $gap-big;
}

}

/* Only back-end
@@ -11,6 +11,7 @@

figcaption {
color: $grey-font-color;
font-size: .875rem;
max-width: $max-width-s;
margin-left: auto;
margin-right: auto;
@@ -15,7 +15,6 @@
margin: $gap auto;
width: 100%;

// responsive tables
&--responsive {
display: block;
overflow-x: auto;
@@ -30,9 +29,8 @@
background-size: 2.5rem 100%, 2.5rem 100%, .875rem 100%, .875rem 100%;
background-position: 0 0, 100%, 0 0, 100%;
background-attachment: local, local, scroll, scroll;
.wp-block-table__wrapper {
display: table;
width: 100%;
table {
min-width: 100%;
}
}

@@ -73,7 +71,9 @@
}

&.has-fixed-layout {
table-layout: fixed;
&, table {
table-layout: fixed;
}
}

&.is-style-stripes {

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit f3de438

Please sign in to comment.
You can’t perform that action at this time.