From 29517c54e61511aab04888f815905ce6a733269a Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 25 Feb 2024 12:17:11 +0800 Subject: [PATCH] Refactor `copy` button event handler (#29379) Use "closest" instead of "for-loop" (cherry picked from commit 736c98be5c2bed26cef9f7f679c49a95af8161ef) --- web_src/js/features/clipboard.js | 41 +++++++++++++------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/web_src/js/features/clipboard.js b/web_src/js/features/clipboard.js index 224628658e..8be5505c8b 100644 --- a/web_src/js/features/clipboard.js +++ b/web_src/js/features/clipboard.js @@ -5,37 +5,30 @@ import {clippie} from 'clippie'; const {copy_success, copy_error} = window.config.i18n; // Enable clipboard copy from HTML attributes. These properties are supported: -// - data-clipboard-text: Direct text to copy, has highest precedence +// - data-clipboard-text: Direct text to copy // - data-clipboard-target: Holds a selector for a or