-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rel="noopener noreferrer" wherever target="_blank" is used #7680
Changes from all commits
1dbaeb2
723efdf
fec2764
efd6fda
e995945
37d2345
2a0299a
6b04348
5ebfef5
158a719
9a0c6cc
d8f5162
c7c5163
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ export default React.createClass( { | |
href: React.PropTypes.string, | ||
onClick: React.PropTypes.func, | ||
icon: React.PropTypes.bool, | ||
iconSize: React.PropTypes.number | ||
iconSize: React.PropTypes.number, | ||
target: React.PropTypes.string | ||
}, | ||
|
||
getDefaultProps() { | ||
|
@@ -41,6 +42,10 @@ export default React.createClass( { | |
rel: 'external' | ||
} ); | ||
|
||
if ( props.target ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you specify an arbitrary target like |
||
props.rel = props.rel.concat( ' noopener noreferrer' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL No need to change anything. |
||
} | ||
|
||
return ( | ||
<a { ...props }> | ||
{ this.props.children } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be argued that these be included in the
else
block inrender
to push intoomitProps
for the button case, since they're not valid attributes for a button. This assumes someone renders as a button withrel
andtarget
but nothref
, which is unlikely, be "possible".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Added in b88562b.