-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Link style #1681
Link style #1681
Conversation
also makes our handling of style and href more flexible and robust
// so we need to use dy along with the uber hacky shift-back-to | ||
// baseline below | ||
sup: 'font-size:70%" dy="-0.6em', | ||
sub: 'font-size:70%" dy="0.3em', | ||
b: 'font-weight:bold', | ||
i: 'font-style:italic', | ||
a: '', | ||
a: 'cursor:pointer', |
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.
👌
@@ -254,6 +260,16 @@ var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function | |||
|
|||
var NEWLINES = /(\r\n?|\n)/g; | |||
|
|||
var SPLIT_TAGS = /(<[^<>]*>)/; |
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.
🐎
@@ -120,7 +122,8 @@ describe('svg+text utils', function() { | |||
assertAnchorLink(node, 'mailto:support@plot.ly'); | |||
}); | |||
|
|||
it('wraps XSS attacks in href', function() { | |||
it('drops XSS attacks in href', function() { | |||
// "XSS" gets interpreted as a relative link (http) |
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.
Nice!
and test these as well as tag auto-close/open
@@ -283,7 +283,7 @@ describe('Test sort transform interactions:', function() { | |||
|
|||
function wait() { | |||
return new Promise(function(resolve) { | |||
setTimeout(resolve, 60); | |||
setTimeout(resolve, 100); |
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.
@etpinard it took 3 tries to get this test to pass on CI with the original timeout, first try with it a little longer.
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.
👍
// Style and href: pull them out of either single or double quotes. | ||
// Because we hack in other attributes with style (sub & sup), drop any trailing | ||
// semicolon in user-supplied styles so we can consistently append the tag-dependent style | ||
var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; |
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.
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.
(PSA: have to be careful with g
! it adds a dependency on internal state of a regexp, which is super confusing if you're not expecting it)
Looks good 💃 |
Fixes #1674
cursor: pointer
like regular html links<a>
elements in text, and make our parsing of these fields more robust@etpinard OK?