Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thead > td support #24

Open
iamrobert opened this issue Jul 22, 2022 · 1 comment
Open

Add thead > td support #24

iamrobert opened this issue Jul 22, 2022 · 1 comment

Comments

@iamrobert
Copy link

Hi Jerry,

Great library.

With our CMS, it has a weird output for the tables as:

thead > tr > td

Do you think adding this line to your library would help make it more accessible?

      if (this.options.header) {
        let format = "";
        if (table.querySelectorAll("thead tr th").length) {
          format = "thead th";
        //Added Support
        } else if (table.querySelectorAll("thead tr td").length) {
           format = "thead td";
        } else if (table.querySelectorAll("tbody tr th").length) {
          format = "tbody tr th";
        } else if (table.querySelectorAll("th").length) {
          format = "tr:first th";
        } else {
          format = "tr:first td";
        }

Cheers,

Robert

@jerrylow
Copy link
Owner

jerrylow commented Aug 2, 2022

Hey @iamrobert the last condition should have taken care of this. What structure is your CMS outputting? Here's a sample I quickly mocked up: https://jsfiddle.net/owL2brd8/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants