Make WordPress Core

Changeset 49215


Ignore:
Timestamp:
10/19/2020 11:37:53 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r49193 r49215  
    731731            ),
    732732            'actions'     => sprintf(
    733                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     733                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    734734                esc_url( wp_get_update_php_url() ),
    735735                __( 'Learn more about updating PHP' ),
     
    843843                    /* translators: Localized team handbook, if one exists. */
    844844                    esc_url( __( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ),
    845                     'target="_blank" rel="noopener noreferrer"',
     845                    'target="_blank" rel="noopener"',
    846846                    sprintf(
    847847                        ' <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span>',
     
    11601160            ),
    11611161            'actions'     => sprintf(
    1162                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1162                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    11631163                /* translators: Localized version of WordPress requirements if one exists. */
    11641164                esc_url( __( 'https://wordpress.org/about/requirements/' ) ),
     
    13971397
    13981398            $result['actions'] = sprintf(
    1399                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1399                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    14001400                /* translators: Localized Support reference. */
    14011401                esc_url( __( 'https://wordpress.org/support' ) ),
     
    14351435            ),
    14361436            'actions'     => sprintf(
    1437                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1437                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    14381438                /* translators: Documentation explaining debugging in WordPress. */
    14391439                esc_url( __( 'https://wordpress.org/support/article/debugging-in-wordpress/' ) ),
     
    15041504            ),
    15051505            'actions'     => sprintf(
    1506                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1506                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    15071507                /* translators: Documentation explaining HTTPS and why it should be used. */
    15081508                esc_url( __( 'https://wordpress.org/support/article/why-should-i-use-https/' ) ),
  • trunk/src/wp-admin/includes/dashboard.php

    r49146 r49215  
    17621762        <?php
    17631763        printf(
    1764             '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
     1764            '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
    17651765            esc_url( wp_get_update_php_url() ),
    17661766            __( 'Learn more about updating PHP' ),
  • trunk/src/wp-admin/includes/media.php

    r49209 r49215  
    32173217            __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
    32183218            esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
    3219             'target="_blank" rel="noopener noreferrer"',
     3219            'target="_blank" rel="noopener"',
    32203220            sprintf(
    32213221                '<span class="screen-reader-text"> %s</span>',
  • trunk/src/wp-includes/class-walker-nav-menu.php

    r49193 r49215  
    174174        $atts['target'] = ! empty( $item->target ) ? $item->target : '';
    175175        if ( '_blank' === $item->target && empty( $item->xfn ) ) {
    176             $atts['rel'] = 'noopener noreferrer';
     176            $atts['rel'] = 'noopener';
    177177        } else {
    178178            $atts['rel'] = $item->xfn;
  • trunk/src/wp-includes/comment.php

    r49211 r49215  
    36483648                    $value = get_comment_link( $comment->comment_ID );
    36493649                    $value = sprintf(
    3650                         '<a href="%s" target="_blank" rel="noreferrer noopener">%s</a>',
     3650                        '<a href="%s" target="_blank" rel="noopener">%s</a>',
    36513651                        esc_url( $value ),
    36523652                        esc_html( $value )
  • trunk/src/wp-includes/formatting.php

    r49193 r49215  
    31543154
    31553155/**
    3156  * Adds rel noreferrer and noopener to all HTML A elements that have a target.
     3156 * Adds `rel="noopener"` to all HTML A elements that have a target.
    31573157 *
    31583158 * @since 5.1.0
     3159 * @since 5.6.0 Removed 'noreferrer' relationship.
    31593160 *
    31603161 * @param string $text Content that may contain HTML A elements.
     
    31893190
    31903191/**
    3191  * Callback to add rel="noreferrer noopener" string to HTML A element.
    3192  *
    3193  * Will not duplicate existing noreferrer and noopener values
    3194  * to prevent from invalidating the HTML.
     3192 * Callback to add `rel="noopener"` string to HTML A element.
     3193 *
     3194 * Will not duplicate an existing 'noopener' value to avoid invalidating the HTML.
    31953195 *
    31963196 * @since 5.1.0
    3197  *
    3198  * @param array $matches Single Match
    3199  * @return string HTML A Element with rel noreferrer noopener in addition to any existing values
     3197 * @since 5.6.0 Removed 'noreferrer' relationship.
     3198 *
     3199 * @param array $matches Single match.
     3200 * @return string HTML A Element with `rel="noopener"` in addition to any existing values.
    32003201 */
    32013202function wp_targeted_link_rel_callback( $matches ) {
     
    32203221     * @param string $link_html The matched content of the link tag including all HTML attributes.
    32213222     */
    3222     $rel = apply_filters( 'wp_targeted_link_rel', 'noopener noreferrer', $link_html );
     3223    $rel = apply_filters( 'wp_targeted_link_rel', 'noopener', $link_html );
    32233224
    32243225    // Return early if no rel values to be added or if no actual target attribute.
  • trunk/src/wp-includes/functions.php

    r49212 r49215  
    75417541    echo '<p class="button-container">';
    75427542    printf(
    7543         '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
     7543        '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
    75447544        esc_url( $direct_update_url ),
    75457545        __( 'Update PHP' ),
  • trunk/src/wp-includes/media-template.php

    r49207 r49215  
    161161        __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
    162162        esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
    163         'target="_blank" rel="noopener noreferrer"',
     163        'target="_blank" rel="noopener"',
    164164        sprintf(
    165165            '<span class="screen-reader-text"> %s</span>',
  • trunk/src/wp-includes/widgets/class-wp-widget-custom-html.php

    r49193 r49215  
    147147        $content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
    148148
    149         // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
     149        // Adds 'noopener' relationship, without duplicating values, to all HTML A elements that have a target.
    150150        $content = wp_targeted_link_rel( $content );
    151151
  • trunk/src/wp-includes/widgets/class-wp-widget-text.php

    r49120 r49215  
    332332        $text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text );
    333333
    334         // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
     334        // Adds 'noopener' relationship, without duplicating values, to all HTML A elements that have a target.
    335335        $text = wp_targeted_link_rel( $text );
    336336
  • trunk/src/wp-login.php

    r49110 r49215  
    690690
    691691                printf(
    692                     '<a href="%s" rel="noopener noreferrer" target="_blank">%s%s</a>',
     692                    '<a href="%s" rel="noopener" target="_blank">%s%s</a>',
    693693                    esc_url( $admin_email_help_url ),
    694694                    __( 'Why is this important?' ),
     
    15411541                        if ( links[i].href ) {
    15421542                            links[i].target = '_blank';
    1543                             links[i].rel = 'noreferrer noopener';
     1543                            links[i].rel = 'noopener';
    15441544                        }
    15451545                    }
  • trunk/tests/phpunit/tests/formatting/WPTargetedLinkRel.php

    r48937 r49215  
    99    public function test_add_to_links_with_target_blank() {
    1010        $content  = '<p>Links: <a href="/" target="_blank">No rel</a></p>';
    11         $expected = '<p>Links: <a href="/" target="_blank" rel="noopener noreferrer">No rel</a></p>';
     11        $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">No rel</a></p>';
    1212        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    1313    }
     
    1515    public function test_add_to_links_with_target_foo() {
    1616        $content  = '<p>Links: <a href="/" target="foo">No rel</a></p>';
    17         $expected = '<p>Links: <a href="/" target="foo" rel="noopener noreferrer">No rel</a></p>';
     17        $expected = '<p>Links: <a href="/" target="foo" rel="noopener">No rel</a></p>';
    1818        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    1919    }
     
    2121    public function test_target_as_first_attribute() {
    2222        $content  = '<p>Links: <a target="_blank" href="#">No rel</a></p>';
    23         $expected = '<p>Links: <a target="_blank" href="#" rel="noopener noreferrer">No rel</a></p>';
     23        $expected = '<p>Links: <a target="_blank" href="#" rel="noopener">No rel</a></p>';
    2424        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    2525    }
     
    2727    public function test_add_to_existing_rel() {
    2828        $content  = '<p>Links: <a href="/" rel="existing values" target="_blank">Existing rel</a></p>';
    29         $expected = '<p>Links: <a href="/" rel="existing values noopener noreferrer" target="_blank">Existing rel</a></p>';
     29        $expected = '<p>Links: <a href="/" rel="existing values noopener" target="_blank">Existing rel</a></p>';
    3030        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    3131    }
     
    3333    public function test_no_duplicate_values_added() {
    3434        $content  = '<p>Links: <a href="/" rel="existing noopener values" target="_blank">Existing rel</a></p>';
    35         $expected = '<p>Links: <a href="/" rel="existing noopener values noreferrer" target="_blank">Existing rel</a></p>';
     35        $expected = '<p>Links: <a href="/" rel="existing noopener values" target="_blank">Existing rel</a></p>';
    3636        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    3737    }
     
    3939    public function test_rel_with_single_quote_delimiter() {
    4040        $content  = '<p>Links: <a href="/" rel=\'existing values\' target="_blank">Existing rel</a></p>';
    41         $expected = '<p>Links: <a href="/" rel="existing values noopener noreferrer" target="_blank">Existing rel</a></p>';
     41        $expected = '<p>Links: <a href="/" rel="existing values noopener" target="_blank">Existing rel</a></p>';
    4242        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    4343    }
     
    4545    public function test_rel_with_no_delimiter() {
    4646        $content  = '<p>Links: <a href="/" rel=existing target="_blank">Existing rel</a></p>';
    47         $expected = '<p>Links: <a href="/" rel="existing noopener noreferrer" target="_blank">Existing rel</a></p>';
     47        $expected = '<p>Links: <a href="/" rel="existing noopener" target="_blank">Existing rel</a></p>';
    4848        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    4949    }
     
    5151    public function test_rel_value_spaced_and_no_delimiter() {
    5252        $content  = '<p>Links: <a href="/" rel = existing target="_blank">Existing rel</a></p>';
    53         $expected = '<p>Links: <a href="/" rel="existing noopener noreferrer" target="_blank">Existing rel</a></p>';
     53        $expected = '<p>Links: <a href="/" rel="existing noopener" target="_blank">Existing rel</a></p>';
    5454        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    5555    }
     
    5757    public function test_escaped_quotes() {
    5858        $content  = '<p>Links: <a href=\"/\" rel=\"existing values\" target=\"_blank\">Existing rel</a></p>';
    59         $expected = '<p>Links: <a href=\"/\" rel=\"existing values noopener noreferrer\" target=\"_blank\">Existing rel</a></p>';
     59        $expected = '<p>Links: <a href=\"/\" rel=\"existing values noopener\" target=\"_blank\">Existing rel</a></p>';
    6060        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    6161    }
     
    6363    public function test_ignore_links_with_no_target() {
    6464        $content  = '<p>Links: <a href="/" target="_blank">Change me</a> <a href="/">Do not change me</a></p>';
    65         $expected = '<p>Links: <a href="/" target="_blank" rel="noopener noreferrer">Change me</a> <a href="/">Do not change me</a></p>';
     65        $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">Change me</a> <a href="/">Do not change me</a></p>';
    6666        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    6767    }
     
    8686    public function test_wp_targeted_link_rel_filters_run() {
    8787        $content  = '<p>Links: <a href="/" target="_blank">No rel</a></p>';
    88         $expected = '<p>Links: <a href="/" target="_blank" rel="noopener noreferrer">No rel</a></p>';
     88        $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">No rel</a></p>';
    8989
    9090        $post = $this->factory()->post->create_and_get(
     
    104104    public function test_wp_targeted_link_rel_should_preserve_json() {
    105105        $content  = '<p>Links: <a href=\"\/\" target=\"_blank\">No rel<\/a><\/p>';
    106         $expected = '<p>Links: <a href=\"\/\" target=\"_blank\" rel=\"noopener noreferrer\">No rel<\/a><\/p>';
     106        $expected = '<p>Links: <a href=\"\/\" target=\"_blank\" rel=\"noopener\">No rel<\/a><\/p>';
    107107        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    108108    }
     
    115115    public function test_wp_targeted_link_rel_skips_style_and_scripts() {
    116116        $content  = '<style><a href="/" target=a></style><p>Links: <script>console.log("<a href=\'/\' target=a>hi</a>");</script><script>alert(1);</script>here <a href="/" target=_blank>aq</a></p><script>console.log("<a href=\'last\' target=\'_blank\'")</script>';
    117         $expected = '<style><a href="/" target=a></style><p>Links: <script>console.log("<a href=\'/\' target=a>hi</a>");</script><script>alert(1);</script>here <a href="/" target="_blank" rel="noopener noreferrer">aq</a></p><script>console.log("<a href=\'last\' target=\'_blank\'")</script>';
     117        $expected = '<style><a href="/" target=a></style><p>Links: <script>console.log("<a href=\'/\' target=a>hi</a>");</script><script>alert(1);</script>here <a href="/" target="_blank" rel="noopener">aq</a></p><script>console.log("<a href=\'last\' target=\'_blank\'")</script>';
    118118        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    119119    }
     
    132132    public function test_wp_targeted_link_rel_tab_separated_values_are_split() {
    133133        $content  = "<p>Links: <a href=\"/\" target=\"_blank\" rel=\"ugc\t\tnoopener\t\">No rel</a></p>";
    134         $expected = '<p>Links: <a href="/" target="_blank" rel="ugc noopener noreferrer">No rel</a></p>';
     134        $expected = '<p>Links: <a href="/" target="_blank" rel="ugc noopener">No rel</a></p>';
    135135        $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    136136    }
  • trunk/tests/phpunit/tests/menu/walker-nav-menu.php

    r46586 r49215  
    3838
    3939    /**
    40      * Tests when an item's target is _blank, that rel="noopener noreferrer" is added.
     40     * Tests when an item's target is _blank, that rel="noopener" is added.
    4141     *
    4242     * @ticket 43290
     
    6565        $this->walker->start_el( $expected, (object) $item, 0, (object) $args );
    6666
    67         $this->assertSame( "<li id=\"menu-item-{$post_id}\" class=\"menu-item-{$post_id}\"><a target=\"_blank\" rel=\"noopener noreferrer\">{$post_title}</a>", $expected );
     67        $this->assertSame( "<li id=\"menu-item-{$post_id}\" class=\"menu-item-{$post_id}\"><a target=\"_blank\" rel=\"noopener\">{$post_title}</a>", $expected );
    6868    }
    6969
  • trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php

    r49090 r49215  
    479479                        array(
    480480                            'name'  => 'Comment URL',
    481                             'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noreferrer noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
     481                            'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
    482482                        ),
    483483                    ),
     
    509509                        array(
    510510                            'name'  => 'Comment URL',
    511                             'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-3" target="_blank" rel="noreferrer noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-3</a>',
     511                            'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-3" target="_blank" rel="noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-3</a>',
    512512                        ),
    513513                    ),
     
    621621                        array(
    622622                            'name'  => 'Comment URL',
    623                             'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noreferrer noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
     623                            'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
    624624                        ),
    625625                    ),
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r49047 r49215  
    11631163                    ),
    11641164                    'description' => array(
    1165                         'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    1166                         'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     1165                        'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     1166                        'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    11671167                    ),
    11681168                    'caption'     => array(
    1169                         'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    1170                         'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     1169                        'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     1170                        'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    11711171                    ),
    11721172                ),
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r49108 r49215  
    36973697                    ),
    36983698                    'content' => array(
    3699                         'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    3700                         'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     3699                        'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     3700                        'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    37013701                    ),
    37023702                    'excerpt' => array(
    3703                         'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    3704                         'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     3703                        'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     3704                        'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    37053705                    ),
    37063706                ),
  • trunk/tests/phpunit/tests/widgets/custom-html-widget.php

    r48937 r49215  
    305305
    306306    /**
    307      * Ensure that rel="noopener noreferrer" is added to links with a target.
     307     * Ensure that rel="noopener" is added to links with a target.
    308308     *
    309309     * @ticket 46421
     
    327327
    328328        $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    329         $this->assertContains( 'rel="noopener noreferrer"', $output );
    330     }
    331 
    332     /**
    333      * Ensure that rel="noopener noreferrer" is not added to links without a target.
     329        $this->assertContains( 'rel="noopener"', $output );
     330    }
     331
     332    /**
     333     * Ensure that rel="noopener" is not added to links without a target.
    334334     *
    335335     * @ticket 46421
     
    353353
    354354        $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    355         $this->assertNotContains( 'rel="noopener noreferrer"', $output );
     355        $this->assertNotContains( 'rel="noopener"', $output );
    356356    }
    357357
  • trunk/tests/phpunit/tests/widgets/media-image-widget.php

    r49052 r49215  
    543543        $this->assertContains( '<a href="https://example.org"', $output );
    544544        $this->assertContains( 'target="_blank"', $output );
    545         $this->assertContains( 'rel="noopener noreferrer"', $output );
     545        $this->assertContains( 'rel="noopener"', $output );
    546546
    547547        // Populate caption in attachment.
  • trunk/tests/phpunit/tests/widgets/text-widget.php

    r48937 r49215  
    10041004
    10051005    /**
    1006      * Ensure that rel="noopener noreferrer" is added to links with a target.
     1006     * Ensure that rel="noopener" is added to links with a target.
    10071007     *
    10081008     * @ticket 46421
     
    10271027        $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    10281028
    1029         $this->assertContains( 'rel="noopener noreferrer"', $output );
    1030     }
    1031 
    1032     /**
    1033      * Ensure that rel="noopener noreferrer" is not added to links without a target.
     1029        $this->assertContains( 'rel="noopener"', $output );
     1030    }
     1031
     1032    /**
     1033     * Ensure that rel="noopener" is not added to links without a target.
    10341034     *
    10351035     * @ticket 46421
     
    10541054        $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    10551055
    1056         $this->assertNotContains( 'rel="noopener noreferrer"', $output );
     1056        $this->assertNotContains( 'rel="noopener"', $output );
    10571057    }
    10581058}
  • trunk/tests/qunit/index.html

    r49151 r49215  
    11741174                        <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
    11751175                    </label>
    1176                     <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1176                    <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    11771177                <# } #>
    11781178                                <label class="setting" data-setting="title">
     
    13391339                <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
    13401340            </label>
    1341             <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1341            <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    13421342        <# } #>
    13431343                <label class="setting" data-setting="title">
     
    16311631            <input type="text" data-setting="alt" aria-describedby="alt-text-description" />
    16321632        </label>
    1633         <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1633        <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    16341634
    16351635                    <label class="setting caption">
     
    16861686                        <input type="text" data-setting="alt" value="{{ data.model.alt }}" aria-describedby="alt-text-description" />
    16871687                    </label>
    1688                     <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1688                    <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    16891689
    16901690                                            <label class="setting caption">
Note: See TracChangeset for help on using the changeset viewer.