-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Tag Processor: Add Bookmark Invalidation Logic #4116
Tag Processor: Add Bookmark Invalidation Logic #4116
Conversation
3217dba
to
8f43d6e
Compare
cc/ @dmsnell 😊 |
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.
Adding approval here, given that we already ran review in the Gutenberg repo.
I've also merged this into dmsnell/WordPress-develop html-api/wordpress-6.3
Thank you! 😊 Just noting that we can't merge this to |
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.
- Confirmed this is a copy of Gutenberg PR 47559 ✅
- Includes ticket annotation in tests ✅
- Includes
@since
annotation ✅
Ready for commit 👍
Prepping commit now ✅ |
Committed via https://core.trac.wordpress.org/changeset/55555. |
Thank you very much for landing this @hellofromtonya ! |
- Support a few extra invalid comment syntaxes. WordPress/wordpress-develop#4256 - Invalidate bookmarks which have been eliminated by enqueued changes. WordPress/wordpress-develop#4116 - Expose whether the currently-matched tag has the self-closing flag. WordPress/wordpress-develop#4266 - Avoid double-writing an attribute value if given case-variations of the name. WordPress/wordpress-develop#4337
- Support a few extra invalid comment syntaxes. WordPress/wordpress-develop#4256 - Invalidate bookmarks which have been eliminated by enqueued changes. WordPress/wordpress-develop#4116 - Expose whether the currently-matched tag has the self-closing flag. WordPress/wordpress-develop#4266 - Avoid double-writing an attribute value if given case-variations of the name. WordPress/wordpress-develop#4337 - Linting updates from WordPress/wordpress-develop#4360.
- Support a few extra invalid comment syntaxes. WordPress/wordpress-develop#4256 - Invalidate bookmarks which have been eliminated by enqueued changes. WordPress/wordpress-develop#4116 - Expose whether the currently-matched tag has the self-closing flag. WordPress/wordpress-develop#4266 - Avoid double-writing an attribute value if given case-variations of the name. WordPress/wordpress-develop#4337 - Linting updates from WordPress/wordpress-develop#4360. - Avoid losing previous updates in certain cases when seeking earlier in a document. WordPress/wordpress-develop#4345
Targeting WP 6.3.
While
WP_HTML_Tag_Processor
currently only supports changing a given tag's attributes, we plan to also provide methods to make broader changes (possibly through a subclass ofWP_HTML_Tag_Processor
).An API like that will have the potential of replacing a tag that a bookmark points to. As a preparation, we thus need to make sure that all bookmarks affected by a HTML replacement are invalidated (i.e. released).
This is done by extending the existing loop in
apply_attributes_updates
that adjusts bookmarks' start and end positions upon HTML changes to check if the entire bookmark is within a portion of the HTML that has been replaced.Note that this PR is a backport of WordPress/gutenberg#47559.
Trac ticket: https://core.trac.wordpress.org/ticket/57788
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.