Migrate inline JavaScript event handlers#412
Merged
vagisha merged 4 commits intoMar 28, 2024
Merged
Conversation
- Migrated inline event handlers in the lincs module
labkey-jeckels
approved these changes
Mar 28, 2024
| var link = new Link.LinkBuilder("Share") | ||
| .clearClasses().addClass("button-small button-small-green") | ||
| .style("margin:0px 5px 0px 2px;") | ||
| .onClick("showShareLink(this, '" + PageFlowUtil.filter(accessUrl) + "');return false;"); |
Contributor
There was a problem hiding this comment.
This should be OK in practice, but could break if the value being rendered includes single quotes.
Suggested change
| .onClick("showShareLink(this, '" + PageFlowUtil.filter(accessUrl) + "');return false;"); | |
| .onClick("showShareLink(this, " + PageFlowUtil.jsString(accessUrl) + ");return false;"); |
| <a class="button-small button-small-green" style="margin:0px 5px 0px 2px;" href="" onclick="showShareLink(this, '<%=h(accessUrl)%>'); return false;">Share</a> | ||
| <%=link("Share").clearClasses().addClass("button-small button-small-green") | ||
| .style("margin:0px 5px 0px 2px") | ||
| .onClick("showShareLink(this, '" + h(accessUrl) + "'); return false;")%> |
Contributor
There was a problem hiding this comment.
Suggested change
| .onClick("showShareLink(this, '" + h(accessUrl) + "'); return false;")%> | |
| .onClick("showShareLink(this, " + q(accessUrl) + "); return false;")%> |
labkey-adam
reviewed
Mar 29, 2024
| } | ||
| LABKEY.Utils.onReady(function() | ||
| { | ||
| document.getElementById("customGctButton").onclick = function() { showCustomGCTForm(); }; |
Contributor
There was a problem hiding this comment.
This is already merged and no need to change, but:
- By convention, we usually do something like:
document.getElementById("customGctButton")['onclick'] = function().... This drops the migrated handlers from text searches looking for typical inline handler patterns ("onclick = "). - Since there are no parameters,
= showCustomGCTForm;should work as well.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Migrated inline even handlers in the panoramapublic and lincs modules