Repository navigation
Commit a549799
committed
Block Processor: Find a delimiter's comment closer by its
The closer search used `strpos( $text, '--' )`, which stops at every
dash in the JSON attributes, and then `strspn()` over the dash run.
Search for `>` instead. No closer can end before the first `>` after
the start of the JSON span, so that `>` closes the comment if `--` or
`--!` precedes it, and otherwise the search continues after it. The
block editor escapes `>` in attributes as `>`, so the first `>` is
usually the closer.
Scanning theme templates with `next_token()` takes 3% less time; other
documents change by 1% to 2%.
Adds tests for `>` inside of the JSON attributes.
See #66138.>.1 parent fb83653 commit a549799
2 files changed
Lines changed: 12 additions & 9 deletions
File tree
- src/wp-includes
- tests/phpunit/tests/block-processor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
989 | | - | |
| 989 | + | |
990 | 990 | | |
991 | 991 | | |
992 | 992 | | |
993 | | - | |
| 993 | + | |
994 | 994 | | |
995 | | - | |
996 | | - | |
| 995 | + | |
| 996 | + | |
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
| 1000 | + | |
| 1001 | + | |
1005 | 1002 | | |
1006 | 1003 | | |
1007 | 1004 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
726 | 732 | | |
727 | 733 | | |
728 | 734 | | |
| |||
0 commit comments