-
Notifications
You must be signed in to change notification settings - Fork 9.6k
report(dom): handle undefined link url from proto roundtrip #12872
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
Conversation
| */ | ||
| safelySetHref(elem, url) { | ||
| // Defaults to '' to fix proto roundtrip issue. | ||
| url = url || ''; |
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.
doing this instead of default param value, because that makes typescript make the second param optional.
patrickhulce
left a comment
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.
thanks @derevandal !
| * Set link href, but safely, preventing `javascript:` protocol, etc. | ||
| * @see https://github.com/google/safevalues/ | ||
| * @param {HTMLAnchorElement} elem | ||
| * @param {string} url |
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.
| * @param {string} url | |
| * @param {string|undefined} url |
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.
I'd prefer not littering our types with this, just because a use case comes to us from proto. If we were to go down that route, we should turn all string into string|undefined in the report.
We've got to address the root cause eventually, maybe changes like this would be included in that.
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.
we should turn all string into string|undefined in the report.
I agree :)
If you want to postpone this for a more thorough examination of all usage that wfm though.
Co-authored-by: Patrick Hulce <[email protected]>
andrevandal
left a comment
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.
LGTM
ref #12868
Commit with message: