Media: Add "loading" as an allowed kses image attribute
With loading="lazy" being added to all images in [47554], let's ensure that it passes kses attributes too. Fixes #50731. Props TimothyBlynJacobs, peterwilsoncc, azaozz. git-svn-id: https://develop.svn.wordpress.org/trunk@48572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e306fca2c1
commit
447d25f090
@ -230,6 +230,7 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'border' => true,
|
'border' => true,
|
||||||
'height' => true,
|
'height' => true,
|
||||||
'hspace' => true,
|
'hspace' => true,
|
||||||
|
'loading' => true,
|
||||||
'longdesc' => true,
|
'longdesc' => true,
|
||||||
'vspace' => true,
|
'vspace' => true,
|
||||||
'src' => true,
|
'src' => true,
|
||||||
|
@ -765,6 +765,11 @@ EOF;
|
|||||||
'src="mypic.jpg"',
|
'src="mypic.jpg"',
|
||||||
'src="mypic.jpg"',
|
'src="mypic.jpg"',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'img',
|
||||||
|
'loading="lazy"',
|
||||||
|
'loading="lazy"',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'img',
|
'img',
|
||||||
'onerror=alert(1)',
|
'onerror=alert(1)',
|
||||||
@ -1352,4 +1357,26 @@ EOF;
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test filtering a standard img tag.
|
||||||
|
*
|
||||||
|
* @ticket 50731
|
||||||
|
*/
|
||||||
|
function test_wp_kses_img_tag_standard_attributes() {
|
||||||
|
$html = array(
|
||||||
|
'<img',
|
||||||
|
'loading="lazy"',
|
||||||
|
'src="https://example.com/img.jpg"',
|
||||||
|
'width="1000"',
|
||||||
|
'height="1000"',
|
||||||
|
'alt=""',
|
||||||
|
'class="wp-image-1000"',
|
||||||
|
'/>',
|
||||||
|
);
|
||||||
|
|
||||||
|
$html = implode( ' ', $html );
|
||||||
|
|
||||||
|
$this->assertSame( $html, wp_kses_post( $html ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user