Skip to content

Commit 796e0d7

Browse files
committed
Enable clearing inner HTML
1 parent 097f4eb commit 796e0d7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public static function create_full_parser( $html, $known_definite_encoding = 'UT
355355
return $processor;
356356
}
357357

358-
public function set_inner_html( $html ) {
358+
public function set_inner_html( ?string $html ) {
359359
if ( $this->is_virtual() ) {
360360
return false;
361361
}
@@ -379,10 +379,7 @@ public function set_inner_html( $html ) {
379379
return false;
380380
}
381381

382-
$html_for_replacement = $this->normalize( $html );
383-
if ( empty( $html_for_replacement ) ) {
384-
return false;
385-
}
382+
$html = $html ? $this->normalize( $html ) : '';
386383

387384
// @todo apply modifications if there are any???
388385
@@ -405,7 +402,7 @@ public function set_inner_html( $html ) {
405402
$this->lexical_updates['innerHTML'] = new WP_HTML_Text_Replacement(
406403
$inner_html_start,
407404
$inner_html_length,
408-
$html_for_replacement
405+
$html
409406
);
410407

411408
parent::seek( 'SET_INNER_HTML: opener' );

0 commit comments

Comments
 (0)