diff --git a/lib/experimental/html/class-wp-html-tag-processor.php b/lib/experimental/html/class-wp-html-tag-processor.php index affbb6fb27b5c1..f21d52ddf810a5 100644 --- a/lib/experimental/html/class-wp-html-tag-processor.php +++ b/lib/experimental/html/class-wp-html-tag-processor.php @@ -1657,7 +1657,14 @@ public function get_updated_html() { $this->updated_bytes = strlen( $this->updated_html ); // 3. Point this tag processor at the original tag opener and consume it - $this->parsed_bytes = strlen( $updated_html_up_to_current_tag_name_end ) - $this->tag_name_length - 2; + + /* + * When we get here we're at the end of the tag name, and we want to rewind to before it + *

Previous HTMLMore HTML

+ * ^ | back up by the length of the tag name plus the opening < + * \<-/ back up by strlen("em") + 1 ==> 3 + */ + $this->parsed_bytes = strlen( $updated_html_up_to_current_tag_name_end ) - $this->tag_name_length - 1; $this->next_tag(); return $this->html;