[wp-trac] [WordPress Trac] #45352: wp_targeted_link_rel filter can result in rel attribute with no value

WordPress Trac noreply at wordpress.org
Mon Nov 26 22:11:54 UTC 2018


#45352: wp_targeted_link_rel filter can result in rel attribute with no value
-------------------------------------------------+-------------------------
 Reporter:  spartank                             |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  5.1
Component:  Formatting                           |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch has-unit-   |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by spartank):

 The proposed change makes it impossible to use a filter to not set a value
 for rel on links that open in a new tab. Why shouldn't this be possible as
 opposed to falling back to "noreferrer noopener" if the filter returns an
 empty string?

 Shouldn't the test case be:

 {{{#!php
 public function test_filter_non_empty_value() {
    add_filter('wp_targeted_link_rel', array( $this,
 'filter_empty_targeted_link_rel' ) );
    $content  = '<p>Links: <a href="/" target="_blank">No rel</a></p>';
    $this->assertEquals( $content, wp_targeted_link_rel( $content ) );
    remove_filter( 'wp_targeted_link_rel', array( $this,
 'filter_empty_targeted_link_rel' ) );
 }
 }}}

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


More information about the wp-trac mailing list