Thread:King Dragonhoff/@comment-7964552-20161207101730/@comment-24531999-20170130175349

Ah, this JavaScript needs to be on Common.js: /** Test if an element has a certain class ************************************** * * Description: Uses regular expressions and caching for better performance. * Maintainers: User:Mike Dillon, User:R. Koot, User:SG * * Element.prototypes added based on code by Om Shankar via StackOverflow. */ var hasClass = (function {   var reCache = {};    return function(element, className) {        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp( "(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);       }; }); Element.prototype.hasClassName = function(name) { return hasClass(this, name); }; Element.prototype.addClassName = function(name) { if (!this.hasClassName(name)) { this.className = this.className ? [this.className, name].join(' ') : name; } }; Element.prototype.removeClassName = function(name) { if (this.hasClassName(name)) { var c = this.className; this.className = c.replace(new RegExp("(?:^|\\s+)" + name + "(?:\\s+|$)", "g"), "").trim; } }; /* For internal compatibility -- older defined method, now uses new method */ function hasClassTest(element, className) { return hasClass(element, className); }