Skip to content

Commit 0456be7

Browse files
committed
Improve documentation
1 parent ca16e0e commit 0456be7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,11 +1495,17 @@ private function skip_script_data(): bool {
14951495

14961496
while ( false !== $at && $at < $doc_length ) {
14971497
$at += strcspn( $html, '-<', $at );
1498+
14981499
/*
14991500
* Ultimately a SCRIPT closer (`</script>`) must be found or this function will
1500-
* return false.
1501-
* `</script` is the longest sequence that can be matched, so subsequent length checks
1502-
* are redundant.
1501+
* return false. This removes the need for additional length checks and allows
1502+
* for an early return if it's impossible to find a closer.
1503+
*
1504+
* $at is potentially here
1505+
* ↓
1506+
* </script>
1507+
* ╰──┬───╯
1508+
* $at + 8 additional characters is the minimum length required to skip script data.
15031509
*/
15041510
if ( $at + 8 >= $doc_length ) {
15051511
return false;

0 commit comments

Comments
 (0)