Skip to content

Commit

Permalink
🐛 Fix preview of css with incomplete rows
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Apr 1, 2016
1 parent 7a3571e commit 0b47c91
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/csv-preview-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class CSVPreviewElement extends HTMLElement
columns = if options.header
preview.shift()
else
columnName(i) for i in [0...preview[0].length]
length = Math.max(preview.map((d) -> d.length)...)
columnName(i) for i in [0...length]

table = document.createElement('table')
header = document.createElement('thead')
Expand All @@ -32,9 +33,9 @@ class CSVPreviewElement extends HTMLElement
for row in preview
rowElement = document.createElement('tr')

for value in row
for i in [0...columns.length]
cell = document.createElement('td')
cell.textContent = value
cell.textContent = row[i]
rowElement.appendChild(cell)

body.appendChild(rowElement)
Expand Down

0 comments on commit 0b47c91

Please sign in to comment.