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

HTML API: Ensure that get_modifiable_text() reads enqueued updates. #7150

Conversation

dmsnell
Copy link
Member

@dmsnell dmsnell commented Aug 6, 2024

Trac ticket: Core-61617

When set_modifiable_text() was added to the Tag Processor, it was overlooked that the same information could be queried after setting its value and before proceeding to the next token.

This means that reads following writes return the wrong value.

In this patch, get_modifiable_text() will read any enqueued values before reading from the input HTML document to ensure consistency.

Follow-up to [58829].
Props dmsnell, ramonopoly.

When `set_modifiable_text()` was added to the Tag Processor, it was
overlooked that the same information could be queried after setting
its value and before proceeding to the next token.

This means that reads following writes return the wrong value.

In this patch, `get_modifiable_text()` will read any enqueued values
before reading from the input HTML document to ensure consistency.

Follow-up to [58829].
Props dmsnell, ramonopoly.
Copy link

github-actions bot commented Aug 6, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props dmsnell, ramonopoly.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Aug 6, 2024

Trac Ticket Missing

This pull request is missing a link to a Trac ticket. For a contribution to be considered, there must be a corresponding ticket in Trac.

To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in the Core Handbook.

Copy link

github-actions bot commented Aug 7, 2024

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

When `set_modifiable_text()` was added to the Tag Processor, it was
overlooked that the same information could be queried after setting
its value and before proceeding to the next token.

This means that reads following writes return the wrong value.

In this patch, `get_modifiable_text()` will read any enqueued values
before reading from the input HTML document to ensure consistency.

Follow-up to [58829].
Props dmsnell, ramonopoly.
@dmsnell dmsnell force-pushed the html-api/get-modifiable-text-read-enqueued-updates branch from 4ed33d5 to db23210 Compare August 7, 2024 00:11
Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

I'm not the best person to review here 😅 but I played around with the tests, and on the surface it makes logical sense to me.

Thanks for helping out with this and #7120 🙇🏻

@dmsnell
Copy link
Member Author

dmsnell commented Aug 8, 2024

Merged in [58866]
4026237

@dmsnell dmsnell closed this Aug 8, 2024
@dmsnell dmsnell deleted the html-api/get-modifiable-text-read-enqueued-updates branch August 8, 2024 04:27
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

Successfully merging this pull request may close these issues.

2 participants