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

Table Block - Ensure empty classname is not output onto table element #18861

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Dec 2, 2019

Description

The current version of the table block in master, when saved produces html with an unnecessary class attribute on the table element:

<!-- wp:table -->
<figure class="wp-block-table"><table class=""><tbody><tr><td></td><td></td></tr></tbody></table></figure>
<!-- /wp:table -->

This PR removes that when the class is an empty string. Questionable whether this is even really a bug, but I think it's good to keep the HTML as clean as possible.

Initially I thought this change would require a deprecation, but that doesn't seem to be the case. Following the testing steps confirms that.

How has this been tested?

  1. Start a new post
  2. Switch to the Code Editor
  3. Paste the following table block HTML (which represents how the block used to render):
<!-- wp:table -->
<figure class="wp-block-table"><table class=""><tbody><tr><td></td><td></td></tr></tbody></table></figure>
<!-- /wp:table -->
  1. Switch to the Visual Editor, confirm that the block has no validation errors
  2. Switch back to the Code Editor (or preview the post and inspect the HTML)
  3. Observe that the unnecessary class name is no longer produced

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. .

@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] Table Affects the Table Block labels Dec 2, 2019
@talldan talldan self-assigned this Dec 2, 2019
@talldan talldan mentioned this pull request Dec 2, 2019
5 tasks
Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!

@talldan talldan merged commit cdea387 into master Dec 6, 2019
@talldan talldan deleted the fix/table-block-empty-class branch December 6, 2019 01:00
@youknowriad youknowriad added this to the Gutenberg 7.1 milestone Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Table Affects the Table Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants