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

Blocks: Fix excess whitespace in block style class name (new package: TokenList) #9105

Merged
merged 7 commits into from Aug 20, 2018

Conversation

Projects
None yet
3 participants
@aduth
Member

aduth commented Aug 17, 2018

This pull request seeks to resolve an issue where assigning a block style can introduce unnecessary whitespace to its className. In doing so, it implements a new package, @wordpress/token-list, intended to imitate the interface of DOMTokenList while being constructable and not requiring a DOM. DOMTokenList is the interface used by Element#classList, which is an easier mechanism for working with (adding, removing, replacing) class names.

Testing instructions:

Ensure unit tests pass:

npm test

Verify that changing the "Quote" block style to "Large" has no leading or trailing whitespace in its assigned class name.

@aduth aduth requested a review from youknowriad Aug 17, 2018

Editor: Replace block style by removal
TokenList#replace does not add a style if the original does not exist, which is occasionally true for blocks which have an assumed default active style without the explicitly assigned class name

@gziolo gziolo self-requested a review Aug 20, 2018

@aduth

This comment has been minimized.

Show comment
Hide comment
@aduth

aduth Aug 20, 2018

Member

Reverted changes to introduce lodash-es.

Also updated the snapshot which was (legitimately) failing. Basically the entire intent of the pull request encompassed in 53320eb 😄

Member

aduth commented Aug 20, 2018

Reverted changes to introduce lodash-es.

Also updated the snapshot which was (legitimately) failing. Basically the entire intent of the pull request encompassed in 53320eb 😄

@youknowriad

LGTM 👍

Show outdated Hide outdated lib/client-assets.php

@aduth aduth merged commit 077f6c4 into master Aug 20, 2018

2 checks passed

codecov/project 50.9% (+0.06%) compared to f9da76a
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@youknowriad youknowriad deleted the add/token-list branch Aug 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment