schulle4u / yellow-extensions-schulle4u

My experimental extensions for Datenstrom Yellow.
GNU General Public License v2.0
15 stars 4 forks source link

In Csv <tbody> is closed but not opened if CsvFirstRowHeader = false #29

Closed GiovanniSalmeri closed 2 years ago

GiovanniSalmeri commented 2 years ago

Hello @schulle4u. I think I've found a small glitch in Csv extension. When CsvFirstRowHeader is set to false, the tag <tbody> is closed (in csv.php:87), but never opened, because csv.php:81 is not executed. Perhaps the easiest way to solve this is to generate neither the opening <tbody> nor the closing </tbody>? They are not mandatory and a tbody element is anyway created in the DOM. Just an idea 😊

schulle4u commented 2 years ago

Hi @GiovanniSalmeri,

thanks for the report. You are right, apparently I was a little lost between to many loops and forgot to properly handle the table body. 🙂 However if I understand right removing the tbody element currently is not an option because the JS component of this extension needs it. Unfortunately my javascript knowledge is just a little more than copy/paste from CodePen and StackOverflow, therefore I'll add a fix for the broken html element. 📓

GiovanniSalmeri commented 2 years ago

Two pieces of good news, just out of curiosity. The first: I have checked now, and the script works perfectly even without an explicit <tbody> in HTML, because the Javascript engine inserts it automatically in the DOM where it belongs. The second: in HTML4, omitting the tag <tbody> when <thead> is present was a syntax error... but not anymore in HTML5: I checked and the validator does not complain. But I understand that fixing the missing tag HTML is a cleaner solution 😊

schulle4u commented 2 years ago

Thanks for testing! I also can confirm the behaviour, CSV works properly without a tbody element. Therefore it should be safe to remove it and push an update for the extension. 🙂