Commit d6c227aa authored by Andrii Sagaidak's avatar Andrii Sagaidak Committed by Commit Bot

Not adding no-op onClick event to experiment descriptions

Currently, every experiment description div element receives an onclick event, which will
do an action only if a condition holds. This PR will make a change to not add the onclick
event if it's no-op.

Bug: 986535
Change-Id: I2cde879823faa19f700b18e97c20e4e28dffd84b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713599Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Andrii Sagaidak <ansagaid@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#679830}
parent 8c84328c
......@@ -82,13 +82,13 @@ function renderTemplate(experimentalFeaturesData) {
var smallScreenCheck = window.matchMedia('(max-width: 480px)');
// Toggling of experiment description overflow content on smaller screens.
elements = document.querySelectorAll('.experiment .flex:first-child');
for (var i = 0; i < elements.length; ++i) {
elements[i].onclick = function(e) {
if (smallScreenCheck.matches) {
if(smallScreenCheck.matches){
elements = document.querySelectorAll('.experiment .flex:first-child');
for (var i = 0; i < elements.length; ++i) {
elements[i].onclick = function(e) {
this.classList.toggle('expand');
}
};
};
}
}
$('experiment-reset-all').onclick = resetAllFlags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment