mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #22851 - georgeroman:make_blank_target_imply_noopener, r=cybai,jdm
Make blank target imply noopener, implement "opener" link type <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix part of #22845 <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22851) <!-- Reviewable:end -->
This commit is contained in:
commit
169b8cf144
1 changed files with 8 additions and 1 deletions
|
@ -609,7 +609,14 @@ pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
|
|||
let values = link_types.Value();
|
||||
let contains_noopener = values.contains("noopener");
|
||||
let contains_noreferrer = values.contains("noreferrer");
|
||||
contains_noreferrer || contains_noopener
|
||||
let contains_opener = values.contains("opener");
|
||||
let target_is_blank = if let Some(name) = target_attribute_value.as_ref() {
|
||||
name.Value().to_lowercase() == "_blank"
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
contains_noreferrer || contains_noopener || (!contains_opener && target_is_blank)
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue