forked from hexojs/hexo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "fix: external link ignore mailto: & javascript: (hexojs#3812)"
This reverts commit 91a4784.
- Loading branch information
Showing
3 changed files
with
20 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,27 +206,23 @@ describe('External link - post', () => { | |
'# External link test', | ||
'1. External link', | ||
'<a href="https://hexo.io/">Hexo</a>', | ||
'2. Link with hash (#), mailto: , javascript: shouldn\'t be processed', | ||
'<a href="#top">Hexo</a>', | ||
'<a href="mailto:[email protected]">Hexo</a>', | ||
'<a href="javascript:alert(\'Hexo is awesome!\');">Hexo</a>', | ||
'3. External link with "rel" Attribute', | ||
'2. External link with "rel" Attribute', | ||
'<a rel="external" href="https://hexo.io/">Hexo</a>', | ||
'<a href="https://hexo.io/" rel="external">Hexo</a>', | ||
'<a rel="noopenner" href="https://hexo.io/">Hexo</a>', | ||
'<a href="https://hexo.io/" rel="noopenner">Hexo</a>', | ||
'<a rel="external noopenner" href="https://hexo.io/">Hexo</a>', | ||
'<a href="https://hexo.io/" rel="external noopenner">Hexo</a>', | ||
'4. External link with Other Attributes', | ||
'3. External link with Other Attributes', | ||
'<a class="img" href="https://hexo.io/">Hexo</a>', | ||
'<a href="https://hexo.io/" class="img">Hexo</a>', | ||
'5. Internal link', | ||
'4. Internal link', | ||
'<a href="/archives/foo.html">Link</a>', | ||
'6. Ignore links have "target" attribute', | ||
'5. Ignore links have "target" attribute', | ||
'<a href="https://hexo.io/" target="_blank">Hexo</a>', | ||
'7. Ignore links don\'t have "href" attribute', | ||
'6. Ignore links don\'t have "href" attribute', | ||
'<a>Anchor</a>', | ||
'8. Ignore links whose hostname is same as config', | ||
'7. Ignore links whose hostname is same as config', | ||
'<a href="https://example.com">Example Domain</a>' | ||
].join('\n'); | ||
|
||
|
@@ -237,27 +233,23 @@ describe('External link - post', () => { | |
'# External link test', | ||
'1. External link', | ||
'<a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>', | ||
'2. Link with hash (#), mailto: , javascript: shouldn\'t be processed', | ||
'<a href="#top">Hexo</a>', | ||
'<a href="mailto:[email protected]">Hexo</a>', | ||
'<a href="javascript:alert(\'Hexo is awesome!\');">Hexo</a>', | ||
'3. External link with "rel" Attribute', | ||
'2. External link with "rel" Attribute', | ||
'<a rel="external noopener" href="https://hexo.io/" target="_blank">Hexo</a>', | ||
'<a href="https://hexo.io/" target="_blank" rel="external noopener">Hexo</a>', | ||
'<a rel="noopenner" href="https://hexo.io/" target="_blank">Hexo</a>', | ||
'<a href="https://hexo.io/" target="_blank" rel="noopenner">Hexo</a>', | ||
'<a rel="external noopenner" href="https://hexo.io/" target="_blank">Hexo</a>', | ||
'<a href="https://hexo.io/" target="_blank" rel="external noopenner">Hexo</a>', | ||
'4. External link with Other Attributes', | ||
'3. External link with Other Attributes', | ||
'<a class="img" href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>', | ||
'<a href="https://hexo.io/" target="_blank" rel="noopener" class="img">Hexo</a>', | ||
'5. Internal link', | ||
'4. Internal link', | ||
'<a href="/archives/foo.html">Link</a>', | ||
'6. Ignore links have "target" attribute', | ||
'5. Ignore links have "target" attribute', | ||
'<a href="https://hexo.io/" target="_blank">Hexo</a>', | ||
'7. Ignore links don\'t have "href" attribute', | ||
'6. Ignore links don\'t have "href" attribute', | ||
'<a>Anchor</a>', | ||
'8. Ignore links whose hostname is same as config', | ||
'7. Ignore links whose hostname is same as config', | ||
'<a href="https://example.com">Example Domain</a>' | ||
].join('\n')); | ||
}); | ||
|