[wp-trac] [WordPress Trac] #53839: Add rel="noopener" to output of wp_list_bookmarks() when target is set to "_blank"

WordPress Trac noreply at wordpress.org
Thu Dec 16 15:42:15 UTC 2021


#53839: Add rel="noopener" to output of wp_list_bookmarks() when target is set to
"_blank"
---------------------------------------------+-----------------------------
 Reporter:  tw2113                           |       Owner:  hellofromTonya
     Type:  enhancement                      |      Status:  reopened
 Priority:  normal                           |   Milestone:  5.9
Component:  General                          |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------------
Changes (by david.binda):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Sorry for re-opening the ticket, but I have found out that the PHPUnit
 tests accompanying the functional changeset are not testing all the
 details of the change, as there is a typo in the argument passed to the
 `WP_UnitTestCase::factory()->bookmark->create` method.

 The code in `wp_list_bookmarks` works with the `link_rel` attribute (see
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/bookmark-
 template.php?rev=52061#L104), instead of the `rel` defined in the data
 providers (eg.:
 https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/bookmark/wpListBookmarks.php?rev=52061#L44
 )

 Therefore, the conditional in
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/bookmark-
 template.php?rev=52061#L108 is never matched by the PHPUnit tests, and
 none of the tests are actually passing in any previously existing `rel`
 attribute value; the `noopener`, if expected, is the only value in
 `rel=""`.

 That said, I'm attaching a patch which fixes the typo in existing data
 providers, and adds one more test, which tests whether the noopener is
 actually added to the pre-existing value.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53839#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list