Skip to content

Commit

Permalink
[FIX] Unsafe jQuery plugin (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 authored Nov 24, 2023
1 parent 7f501a8 commit ff1dc29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/middleware/testRunner/testrunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</script>

<script>
jQuery.fn.filterByText = function(textbox) {
jQuery.fn.filterByText = function($textbox) {
return this.each(function() {
var selectbox = this;
var options = [];
Expand All @@ -32,7 +32,10 @@
});
jQuery(selectbox).data("options", options);

jQuery(textbox).on("change keyup", function() {
// jQuery object or a selector
// (https://codeql.github.com/codeql-query-help/javascript/js-unsafe-jquery-plugin/)
$textbox = ($textbox instanceof jQuery) ? $textbox : jQuery(jQuery.find($textbox));
$textbox.on("change keyup", function() {
var options = jQuery(selectbox).empty().data("options");
var search = jQuery(this).val().trim();
var regex = new RegExp(search, "gi");
Expand Down

0 comments on commit ff1dc29

Please sign in to comment.