public
Created

Enable spellcheck: Enforces the `spellcheck` attribute to true.

  • Download Gist
Enable spellcheck 1.01.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
// ==UserScript==
// @name Enable spellcheck
// @version 1.01
// @description Enforces the `spellcheck` attribute to true.
// @namespace https://gist.github.com/3154440/
// @copyright 2012
// @author XP1
// @homepage https://github.com/XP1/
// @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0
// @include http*://*
// ==/UserScript==
 
/*
* Copyright 2012 XP1
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
/*jslint browser: true, vars: true, maxerr: 50, indent: 4 */
(function (window) {
"use strict";
 
function setSpellcheckAttribute() {
var document = window.document;
var elements = document.querySelectorAll("html:not([spellcheck=\"true\"]), input[type=\"text\"]:not([spellcheck=\"true\"]), [spellcheck=\"false\"]");
 
var i = null;
var length = elements.length;
for (i = 0; i < length; i += 1) {
elements[i].setAttribute("spellcheck", "true");
}
}
 
window.addEventListener("DOMContentLoaded", setSpellcheckAttribute, false);
}(this));

I posted this script in this thread:

Activating automatic spell checking on input fields in Opera:
http://superuser.com/questions/424075/activating-automatic-spell-checking-on-input-fields-in-opera/

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.