Created
July 21, 2012 03:19
-
-
Save XP1/3154440 to your computer and use it in GitHub Desktop.
Enable spellcheck: Enforces the `spellcheck` attribute to true.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/