General: Remove noreferrer from wp_targeted_link_rel() and other uses.

When `noopener noreferrer` was originally added in #37941 and related tickets, the `noreferrer` bit was specifically included due to Firefox not supporting `noopener` at the time.

Since `noopener` has been supported by all major browsers for a while, it should now be safe to remove the `noreferrer` attribute from core.

Props Mista-Flo, audrasjb, joostdevalk, jonoaldersonwp, peterwilsoncc, elgameel.
Fixes #49558.

git-svn-id: https://develop.svn.wordpress.org/trunk@49215 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-10-19 23:37:53 +00:00
parent ffbde71040
commit 2a8dae456d
20 changed files with 64 additions and 63 deletions

View File

@@ -304,7 +304,7 @@ class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase {
}
/**
* Ensure that rel="noopener noreferrer" is added to links with a target.
* Ensure that rel="noopener" is added to links with a target.
*
* @ticket 46421
*/
@@ -326,11 +326,11 @@ class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase {
);
$output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
$this->assertContains( 'rel="noopener noreferrer"', $output );
$this->assertContains( 'rel="noopener"', $output );
}
/**
* Ensure that rel="noopener noreferrer" is not added to links without a target.
* Ensure that rel="noopener" is not added to links without a target.
*
* @ticket 46421
*/
@@ -352,7 +352,7 @@ class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase {
);
$output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
$this->assertNotContains( 'rel="noopener noreferrer"', $output );
$this->assertNotContains( 'rel="noopener"', $output );
}
}

View File

@@ -542,7 +542,7 @@ class Test_WP_Widget_Media_Image extends WP_UnitTestCase {
$this->assertContains( '<a href="https://example.org"', $output );
$this->assertContains( 'target="_blank"', $output );
$this->assertContains( 'rel="noopener noreferrer"', $output );
$this->assertContains( 'rel="noopener"', $output );
// Populate caption in attachment.
wp_update_post(

View File

@@ -1003,7 +1003,7 @@ class Test_WP_Widget_Text extends WP_UnitTestCase {
}
/**
* Ensure that rel="noopener noreferrer" is added to links with a target.
* Ensure that rel="noopener" is added to links with a target.
*
* @ticket 46421
*/
@@ -1026,11 +1026,11 @@ class Test_WP_Widget_Text extends WP_UnitTestCase {
$output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
$this->assertContains( 'rel="noopener noreferrer"', $output );
$this->assertContains( 'rel="noopener"', $output );
}
/**
* Ensure that rel="noopener noreferrer" is not added to links without a target.
* Ensure that rel="noopener" is not added to links without a target.
*
* @ticket 46421
*/
@@ -1053,6 +1053,6 @@ class Test_WP_Widget_Text extends WP_UnitTestCase {
$output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
$this->assertNotContains( 'rel="noopener noreferrer"', $output );
$this->assertNotContains( 'rel="noopener"', $output );
}
}