Search code examples
javascriptfirefoxgreasemonkeyspell-checking

Change a textarea's spell-checking language from JavaScript in Firefox


I am trying to write a Greasemonkey user-script for Discord that would change a textarea's spell-checking language whenever I switch channels. And I can't seem to understand, how does Firefox assign a dictionary to an element. What I've tried so far:

  • Setting lang and xml:lang on both the textarea and the form.
  • Changing the id and name of both the textarea and the form.
  • Setting spellcheck to either true or false.

Is it even possible to “give a hint” to Firefox that this element needs to be spell-checked this way?


Solution

  • Apparently, the lang attribute does work, but only if you don't choose the language manually. After you have chosen the language, there is no way to undo that unless you:

    • Turn off Firefox.
    • Go to your profile folder.
    • Use SQLite to remove the preference from content-prefs.sqlite.

    I've filed an issue about it on Mozilla's bug tracker. Until then, SQLite is the way apparently.