-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Remove and prevent DOM access in block attributes matchers #624
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aduth
added
the
[Feature] Block API
API that allows to express the block paradigm.
label
May 3, 2017
aduth
commented
May 3, 2017
}, | ||
|
||
controls: [ 1, 2 ].map( ( variation ) => ( { | ||
icon: 'format-quote', | ||
title: wp.i18n.sprintf( wp.i18n.__( 'Quote style %d' ), variation ), | ||
isActive: ( { style = 1 } ) => style === variation, | ||
isActive: ( { style = 1 } ) => Number( style ) === variation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we'd not need to coerce style to a number, but instead incorporate into attributes (#609) or serialize comment attributes as typed-ish JSON (#482 (comment)).
I like this. |
Merged
aduth
force-pushed
the
update/608-remove-attributes-dom
branch
from
May 5, 2017 12:37
7e7c901
to
3e14439
Compare
This was referenced Apr 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #608
This pull request seeks to remove existing attributes matchers which operate on the DOM; currently image and quote blocks pulling attribute values from element class names. Instead, these attributes are to be encoded into the block comment. Further, it seeks to prevent future attributes created in this pattern by applying an internal flag to acceptable attribute matcher creators (
attr
,children
, etc).Copying an included code comment which elaborates:
Testing instructions:
Ensure that tests pass:
Verify that image alignment and quote styles are still respected, including after changing the values and switching back and forth between Visual and HTML modes.