From 577b6249da6dc7662a34329824c959fd86f674eb Mon Sep 17 00:00:00 2001 From: Tobias Smolka Date: Tue, 3 Jan 2023 11:22:06 +0100 Subject: [PATCH] [js] [atoms] Use .textContent instead of .innerHTML in clear() action --- javascript/atoms/action.js | 6 +++++- javascript/atoms/test/action_test.html | 16 +++++++++++++++- .../test/testdata/trusted_types_iframe.html | 12 ++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 javascript/atoms/test/testdata/trusted_types_iframe.html diff --git a/javascript/atoms/action.js b/javascript/atoms/action.js index 260e046ab8c33..df1457d63efda 100644 --- a/javascript/atoms/action.js +++ b/javascript/atoms/action.js @@ -119,7 +119,11 @@ bot.action.clear = function (element) { // A single space is required, if you put empty string here you'll not be // able to interact with this element anymore in Firefox. bot.action.LegacyDevice_.focusOnElement(element); - element.innerHTML = goog.userAgent.GECKO ? ' ' : ''; + if (goog.userAgent.GECKO) { + element.innerHTML = ' '; + } else { + element.textContent = ''; + } var body = bot.getDocument().body; if (body) { bot.action.LegacyDevice_.focusOnElement(body); diff --git a/javascript/atoms/test/action_test.html b/javascript/atoms/test/action_test.html index 0a6677caa61c6..22d1f0934c939 100644 --- a/javascript/atoms/test/action_test.html +++ b/javascript/atoms/test/action_test.html @@ -5,6 +5,7 @@