Sha256: e8183b9220acd02e20c8e93caa73a486524244e99a9c1db38ad2220684fbd494
Contents?: true
Size: 817 Bytes
Versions: 468
Compression:
Stored size: 817 Bytes
Contents
import PbEnhancedElement from '../pb_enhanced_element' export default class PbTable extends PbEnhancedElement { static get selector() { return '.table-responsive-collapse' } connect() { const tables = document.querySelectorAll('.table-responsive-collapse'); // Each Table [].forEach.call(tables, (table) => { // Header Titles var headers = [].map.call(table.querySelectorAll('th'), (header) => { return header.textContent.replace(/\r?\n|\r/, '') }); // for each row in tbody [].forEach.call(table.querySelectorAll('tbody tr'), (row) => { // for each cell [].forEach.call(row.cells, (cell, headerIndex) => { // apply the attribute cell.setAttribute('data-title', headers[headerIndex]) }) }) }) } }
Version data entries
468 entries across 468 versions & 1 rubygems