Changeset 48983
- Timestamp:
- 09/17/2020 10:12:32 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r48817 r48983 5244 5244 $_links_add_target = $target; 5245 5245 $tags = implode( '|', (array) $tags ); 5246 return preg_replace_callback( "!<($tags)( [^>]*)>!i", '_links_add_target', $content );5246 return preg_replace_callback( "!<($tags)((\s[^>]*)?)>!i", '_links_add_target', $content ); 5247 5247 } 5248 5248 -
trunk/tests/phpunit/tests/formatting/LinksAddTarget.php
r48937 r48983 65 65 'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span src="ABC" target="_top">END TEXT</span>', 66 66 ), 67 array( 68 'MY CONTENT <aside> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </aside> END TEXT', 69 null, 70 null, 71 'MY CONTENT <aside> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC" target="_blank">LINK</a> HERE </aside> END TEXT', 72 ), 73 array( 74 'MY CONTENT <aside class="_blank"> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </aside> END TEXT', 75 null, 76 null, 77 'MY CONTENT <aside class="_blank"> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC" target="_blank">LINK</a> HERE </aside> END TEXT', 78 ), 79 array( 80 'MY CONTENT <blockquote>SOME</blockquote> ADDITIONAL TEXT <b>LINK</b> HERE END TEXT', 81 '_blank', 82 array( 'b' ), 83 'MY CONTENT <blockquote>SOME</blockquote> ADDITIONAL TEXT <b target="_blank">LINK</b> HERE END TEXT', 84 ), 85 array( 86 'MY CONTENT <blockquote target="_self">SOME</blockquote> ADDITIONAL TEXT <b>LINK</b> HERE END TEXT', 87 '_blank', 88 array( 'b' ), 89 'MY CONTENT <blockquote target="_self">SOME</blockquote> ADDITIONAL TEXT <b target="_blank">LINK</b> HERE END TEXT', 90 ), 67 91 ); 68 92 }
Note: See TracChangeset
for help on using the changeset viewer.