File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/compiler/compile/nodes Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -621,22 +621,19 @@ export default class Element extends Node {
621
621
const name_attribute = attribute_map . get ( 'name' ) ;
622
622
const target_attribute = attribute_map . get ( 'target' ) ;
623
623
624
- if ( target_attribute && target_attribute . get_static_value ( ) === '_blank' && href_attribute ) {
624
+ if ( component . compile_options . legacy && target_attribute && target_attribute . get_static_value ( ) === '_blank' && href_attribute ) {
625
625
const href_static_value = href_attribute . get_static_value ( ) ? href_attribute . get_static_value ( ) . toLowerCase ( ) : null ;
626
626
627
627
if ( href_static_value === null || href_static_value . match ( / ^ ( h t t p s ? : ) ? \/ \/ / i) ) {
628
628
const rel = attribute_map . get ( 'rel' ) ;
629
629
if ( rel == null || rel . is_static ) {
630
630
const rel_values = rel ? rel . get_static_value ( ) . split ( regex_any_repeated_whitespaces ) : [ ] ;
631
- const expected_values = [ 'noreferrer' ] ;
632
- expected_values . forEach ( expected_value => {
633
- if ( ! rel || rel && rel_values . indexOf ( expected_value ) < 0 ) {
631
+ if ( ! rel || ( ! rel_values . includes ( 'noopener' ) && ! rel_values . includes ( 'noreferrer' ) ) ) {
634
632
component . warn ( this , {
635
- code : ` security-anchor-rel-${ expected_value } ` ,
636
- message : `Security: Anchor with "target=_blank" should have rel attribute containing the value "${ expected_value } "`
633
+ code : ' security-anchor-rel-noopener' ,
634
+ message : `Security: Anchor with "target=_blank" should have rel attribute containing the value "noopener" or "noreferrer "`
637
635
} ) ;
638
- }
639
- } ) ;
636
+ }
640
637
}
641
638
}
642
639
}
You can’t perform that action at this time.
0 commit comments