filamentgroup / tablesaw

A group of plugins for responsive tables.
MIT License
5.48k stars 434 forks source link

TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node #307

Closed brianjhanson closed 6 years ago

brianjhanson commented 7 years ago

Getting this error tripped by L409 of shoestring-custom

For some reason fragment[j] is returning undefined.

metalandcoffee commented 6 years ago

I'm getting this error as well.

zachleat commented 6 years ago

I haven’t seen this, can you attach a test case?

jerone commented 6 years ago

Currently having this issue, but I was able to consistency replicate it. The issue is the use of newlines inside the table header cells.

This will work (taken from the example):

<table class="tablesaw tablesaw-stack" data-tablesaw-mode="stack">
    <thead>
        <tr>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">Movie Title</th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-sortable-default-col data-tablesaw-priority="3">Rank</th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="2">Year</th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="1"><abbr title="Rotten Tomato Rating">Rating</abbr></th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="4">Gross</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td class="title"><a href="http://en.wikipedia.org/wiki/Avatar_(2009_film)">Avatar</a></td>
            <td>1</td>
            <td>2009</td>
            <td>83%</td>
            <td>$2.7B</td>
        </tr>
    </tbody>
</table>

But this won't (notice the new lines inside the th-elements):

<table class="tablesaw tablesaw-stack" data-tablesaw-mode="stack">
    <thead>
        <tr>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">
                Movie Title
            </th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-sortable-default-col data-tablesaw-priority="3">
                Rank
            </th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="2">
                Year
            </th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="1">
                <abbr title="Rotten Tomato Rating">Rating</abbr>
            </th>
            <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="4">
                Gross
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td class="title"><a href="http://en.wikipedia.org/wiki/Avatar_(2009_film)">Avatar</a></td>
            <td>1</td>
            <td>2009</td>
            <td>83%</td>
            <td>$2.7B</td>
        </tr>
    </tbody>
</table>
jerone commented 6 years ago

@zachleat commented on Nov 15, 2017, 11:24 PM GMT+1:

I haven’t seen this, can you attach a test case?

I moved above test-case html to JsFiddle:

metalandcoffee commented 6 years ago

Is there a fix for this yet? I use both HTML and PHP in <th> when I'm working with filtering so it's not as simple as removing new lines since I have PHP functions inside the tags.

zachleat commented 6 years ago

Thank you @jerone. Those test cases were crucial! This will be included with 3.0.9.