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
Removed inline onchange #13294
Removed inline onchange #13294
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13294 +/- ##
=======================================
Coverage 54.56% 54.56%
=======================================
Files 467 467
Lines 70465 70465
=======================================
Hits 38449 38449
Misses 32016 32016 |
@nijel Can you please restart the build. I think there is some timeout issue. |
changeValueFieldType(this, <?= $search_index; ?>); | ||
}); | ||
</script> |
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.
This really doesn't help for CSP - both need unsafe-inline. Can you please move that to one of js files?
da93350
to
1a76ef6
Compare
@nijel I have updated the PR. |
@nijel @ibennetch Can we merge this PR ? |
I'd like to wait for Michal's comment since he's more familiar with the CSP issue than I am.
|
js/tbl_select.js
Outdated
@@ -81,6 +81,13 @@ AJAX.registerOnload('tbl_select.js', function () { | |||
return false; | |||
}); | |||
|
|||
var tableRows = $('.data tbody tr'); |
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.
This selector looks too generic. Also it's probably better to use $('...').each(...)
instead.
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.
Have you checked this generic selector is actually good?
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.
Yes, It will select the data which have .data
class then the tbody
tag and at the last all the tr
tags inside it. And make an object of the result.
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.
But the data class is used in more situations, won't it match too many?
Also shouldn't you rather target on select instead of tr? The tr certainly doesn't have onchange...
@@ -1,5 +1,4 @@ | |||
<select name="criteriaColumnOperators[<?= $search_index; ?>]" | |||
onchange="changeValueFieldType(this, <?= $search_index; ?>)"> | |||
<select id="ColumnOperator<?= $search_index; ?>" name="criteriaColumnOperators[<?= $search_index; ?>]"> |
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.
Unfortunately I've merged migration of those templates to Twig meanwhile, can you please update your PR?
1a76ef6
to
cfa404d
Compare
@nijel I have update the PR |
js/tbl_select.js
Outdated
@@ -81,6 +81,13 @@ AJAX.registerOnload('tbl_select.js', function () { | |||
return false; | |||
}); | |||
|
|||
var tableRows = $('.data tbody tr'); | |||
$(tableRows).each(function(index, item){ |
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.
You don't need $() around tableRows here (it's already constructed as jQuery object list).
cfa404d
to
9a25e88
Compare
@nijel Updated the PR with the suggested changes. |
9a25e88
to
e2e2add
Compare
@nijel Yes, You are right |
js/tbl_select.js
Outdated
@@ -81,6 +81,13 @@ AJAX.registerOnload('tbl_select.js', function () { | |||
return false; | |||
}); | |||
|
|||
var tableRows = $('select'); |
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.
You can't just match all selects on the page. Probably adding class to the one you want to match is needed. Have you tested the change that it doesn't affect something else?
Signed-off-by: Manish Bisht <manish.bisht490@gmail.com>
e2e2add
to
d5e32c3
Compare
@nijel I have added extra id selector |
Merged, thanks for your contribution! |
Fixes #12261