Optimize is_amp_allowed_attribute checking for reference points#3815
Merged
westonruter merged 1 commit intodevelopfrom Nov 25, 2019
Merged
Optimize is_amp_allowed_attribute checking for reference points#3815westonruter merged 1 commit intodevelopfrom
westonruter merged 1 commit intodevelopfrom
Conversation
schlessera
reviewed
Nov 25, 2019
| ]; | ||
| foreach ( $descendant_reference_points as $ancestor_name => $reference_point_spec ) { | ||
| foreach ( $descendant_reference_points as $ancestor_name => $reference_point_spec_name ) { | ||
| if ( empty( $this->open_elements[ $ancestor_name ] ) ) { |
Collaborator
There was a problem hiding this comment.
This seems to do what the previous code did, so it's the same thing in faster.
However, I'd note that it is not technically correct, as the relationship between "some ancestor" and the descendant is not clear and could be invalid, depending on which nodes are in-between.
Member
Author
There was a problem hiding this comment.
I'm trying to think of an example that would be invalid. Do you have one in mind?
schlessera
approved these changes
Nov 25, 2019
westonruter
added a commit
that referenced
this pull request
Nov 25, 2019
westonruter
added a commit
that referenced
this pull request
Dec 19, 2019
* tag '1.4.2': (25 commits) Bump 1.4.2 Bump 'tested up to' to 5.3.2 Catch unfiltered requests when testing Crowsignal embed (#3956) Bump version 1.4.2-RC1 Bump 'Tested up to' to 5.3.1 Remove test case for paired browsing since broken in WP4.9 and would not pass in AMP 1.4 (#3928) Further refine is_exclusively_dependent and add tests (#3928) Only include hoverintent-js in dev mode if exclusive dependency of admin-bar (#3928) Include admin-bar script deps in dev mode (e.g. hoverintent-js) (#3928) Fix tests after security fix in WP 5.3.1 (r46896) (#3926) Add E2E tests to allow_failures Convert `theme_features` variable into `get_theme_config` function Only apply smooth scroll fix on 'Twenty Twenty' <= 1.0.0 Re-add smooth scrolling fix on WP < 5.3.1 No need to apply smooth scrolling fix for Twenty Twenty theme Bump stylesheet cache group after #3866 (#3880) Return allowed KSES tags if not an array (#3879) Bundle common font files for externalizing data: URLs (#3866) Pull the built `block-libray` package from Gutenberg SVN if it does not exists (#3847) Optimize is_amp_allowed_attribute checking for reference points (#3815) ...
This file contains hidden or 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
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.
Following up on #3243 we can now optimize
\AMP_Tag_And_Attribute_Sanitizer::is_amp_allowed_attribute()by looking at the currently-open elements rather than traversing all the ancestor nodes to see whether an element is open. This PR implements that optimization.