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 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 self-assigned this Dec 2, 2019
@talldan talldan mentioned this pull request Dec 2, 2019
5 of 5 tasks complete
Copy link
Member

noisysocks left a comment

It works!

@talldan talldan merged commit cdea387 into master Dec 6, 2019
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@talldan talldan deleted the fix/table-block-empty-class branch Dec 6, 2019
@youknowriad youknowriad added this to the Gutenberg 7.1 milestone Dec 9, 2019
scruffian added a commit to scruffian/gutenberg that referenced this pull request Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.