diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5a81cce5a..ab464d304 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1452,7 +1452,7 @@ class CommandDispatcher: text: The new text to insert. """ try: - elem.set_text(text) + elem.set_text(text, use_js=True) except webelem.IsNullError: raise cmdexc.CommandError("Element vanished while editing!") diff --git a/qutebrowser/browser/webkit/webelem.py b/qutebrowser/browser/webkit/webelem.py index 3da6227ac..b8ffa1f86 100644 --- a/qutebrowser/browser/webkit/webelem.py +++ b/qutebrowser/browser/webkit/webelem.py @@ -168,10 +168,14 @@ class WebElementWrapper(collections.abc.MutableMapping): self._check_vanished() return self._elem.styleProperty(name, strategy) - def set_text(self, text): - """Set the given plain text.""" + def set_text(self, text, *, use_js=False): + """Set the given plain text. + + Args: + use_js: Whether to use javascript if the element isn't content-editable. + """ self._check_vanished() - if self.is_content_editable(): + if self.is_content_editable() or not use_js: log.misc.debug("Filling element {} via set_text.".format( self.debug_text())) self._elem.setPlainText(text)