Index: src/wp-includes/js/quicktags.js
===================================================================
--- src/wp-includes/js/quicktags.js	(revision 26209)
+++ src/wp-includes/js/quicktags.js	(working copy)
@@ -1,3 +1,4 @@
+/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, fullscreen */
 /*
  * Quicktags
  *
@@ -21,14 +22,16 @@
 // by Alex King
 // http://www.alexking.org/
 
-var QTags, edButtons = [], edCanvas,
+var QTags, edButtons = [], edCanvas;
 
+/* jshint ignore:start */
+
 /**
  * Back-compat
  *
  * Define all former global functions so plugins that hack quicktags.js directly don't cause fatal errors.
  */
-edAddTag = function(){},
+var edAddTag = function(){},
 edCheckOpenTags = function(){},
 edCloseAllTags = function(){},
 edInsertImage = function(){},
@@ -65,16 +68,18 @@
  * Added for back compatibility, use QTags.addButton() as it gives more flexibility like type of button, button placement, etc.
  * @see QTags.addButton()
  */
-function edButton(id, display, tagStart, tagEnd, access, open) {
+function edButton(id, display, tagStart, tagEnd, access) {
 	return QTags.addButton( id, display, tagStart, tagEnd, access, '', -1 );
 }
 
+/* jshint ignore:end */
+
 (function(){
 	// private stuff is prefixed with an underscore
 	var _domReady = function(func) {
-		var t, i,  DOMContentLoaded;
+		var t, i, DOMContentLoaded, _tryReady;
 
-		if ( typeof jQuery != 'undefined' ) {
+		if ( typeof jQuery !== 'undefined' ) {
 			jQuery(document).ready(func);
 		} else {
 			t = _domReady;
@@ -105,16 +110,17 @@
 					document.attachEvent('onreadystatechange', DOMContentLoaded);
 					window.attachEvent('onload', t.ready);
 
-					(function(){
+					_tryReady = function() {
 						try {
-							document.documentElement.doScroll("left");
+							document.documentElement.doScroll('left');
 						} catch(e) {
-							setTimeout(arguments.callee, 50);
+							setTimeout(_tryReady, 50);
 							return;
 						}
 
 						t.ready();
-					})();
+					};
+					_tryReady();
 				}
 
 				t.eventAttached = true;
@@ -128,11 +134,12 @@
 		zeroise = function(number) {
 			var str = number.toString();
 
-			if ( str.length < 2 )
-				str = "0" + str;
+			if ( str.length < 2 ) {
+				str = '0' + str;
+			}
 
 			return str;
-		}
+		};
 
 		return now.getUTCFullYear() + '-' +
 			zeroise( now.getUTCMonth() + 1 ) + '-' +
@@ -145,10 +152,11 @@
 	qt;
 
 	qt = QTags = function(settings) {
-		if ( typeof(settings) == 'string' )
+		if ( typeof(settings) === 'string' ) {
 			settings = {id: settings};
-		else if ( typeof(settings) != 'object' )
+		} else if ( typeof(settings) !== 'object' ) {
 			return false;
+		}
 
 		var t = this,
 			id = settings.id,
@@ -156,15 +164,16 @@
 			name = 'qt_' + id,
 			tb, onclick, toolbar_id;
 
-		if ( !id || !canvas )
+		if ( !id || !canvas ) {
 			return false;
+		}
 
 		t.name = name;
 		t.id = id;
 		t.canvas = canvas;
 		t.settings = settings;
 
-		if ( id == 'content' && typeof(adminpage) == 'string' && ( adminpage == 'post-new-php' || adminpage == 'post-php' ) ) {
+		if ( id === 'content' && typeof(adminpage) === 'string' && ( adminpage === 'post-new-php' || adminpage === 'post-php' ) ) {
 			// back compat hack :-(
 			edCanvas = canvas;
 			toolbar_id = 'ed_toolbar';
@@ -185,8 +194,9 @@
 			var target = e.target || e.srcElement, visible = target.clientWidth || target.offsetWidth, i;
 
 			// don't call the callback on pressing the accesskey when the button is not visible
-			if ( !visible )
+			if ( !visible ) {
 				return;
+			}
 
 			// as long as it has the class ed_button, execute the callback
 			if ( / ed_button /.test(' ' + target.className + ' ') ) {
@@ -194,8 +204,9 @@
 				t.canvas = canvas = document.getElementById(id);
 				i = target.id.replace(name + '_', '');
 
-				if ( t.theButtons[i] )
+				if ( t.theButtons[i] ) {
 					t.theButtons[i].callback.call(t.theButtons[i], target, canvas, t);
+				}
 			}
 		};
 
@@ -232,8 +243,9 @@
 			defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
 
 		for ( inst in t.instances ) {
-			if ( inst == 0 )
+			if ( inst === 0 ) {
 				continue;
+			}
 
 			ed = t.instances[inst];
 			canvas = ed.canvas;
@@ -244,34 +256,38 @@
 			use = '';
 
 			// set buttons
-			if ( settings.buttons )
+			if ( settings.buttons ) {
 				use = ','+settings.buttons+',';
+			}
 
 			for ( i in edButtons ) {
-				if ( !edButtons[i] )
+				if ( !edButtons[i] ) {
 					continue;
+				}
 
 				id = edButtons[i].id;
-				if ( use && defaults.indexOf(','+id+',') != -1 && use.indexOf(','+id+',') == -1 )
+				if ( use && defaults.indexOf(','+id+',') !== -1 && use.indexOf(','+id+',') === -1 ) {
 					continue;
+				}
 
-				if ( !edButtons[i].instance || edButtons[i].instance == inst ) {
+				if ( !edButtons[i].instance || edButtons[i].instance === inst ) {
 					theButtons[id] = edButtons[i];
 
-					if ( edButtons[i].html )
+					if ( edButtons[i].html ) {
 						html += edButtons[i].html(name + '_');
+					}
 				}
 			}
 
-			if ( use && use.indexOf(',fullscreen,') != -1 ) {
-				theButtons['fullscreen'] = new qt.FullscreenButton();
-				html += theButtons['fullscreen'].html(name + '_');
+			if ( use && use.indexOf(',fullscreen,') !== -1 ) {
+				theButtons.fullscreen = new qt.FullscreenButton();
+				html += theButtons.fullscreen.html(name + '_');
 			}
 
 
-			if ( 'rtl' == document.getElementsByTagName('html')[0].dir ) {
-				theButtons['textdirection'] = new qt.TextDirectionButton();
-				html += theButtons['textdirection'].html(name + '_');
+			if ( 'rtl' === document.getElementsByTagName('html')[0].dir ) {
+				theButtons.textdirection = new qt.TextDirectionButton();
+				html += theButtons.textdirection.html(name + '_');
 			}
 
 			ed.toolbar.innerHTML = html;
@@ -309,8 +325,9 @@
 	qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {
 		var btn;
 
-		if ( !id || !display )
+		if ( !id || !display ) {
 			return;
+		}
 
 		priority = priority || 0;
 		arg2 = arg2 || '';
@@ -324,12 +341,13 @@
 			return;
 		}
 
-		if ( priority == -1 ) // back-compat
+		if ( priority === -1 ) { // back-compat
 			return btn;
+		}
 
 		if ( priority > 0 ) {
-			while ( typeof(edButtons[priority]) != 'undefined' ) {
-				priority++
+			while ( typeof(edButtons[priority]) !== 'undefined' ) {
+				priority++;
 			}
 
 			edButtons[priority] = btn;
@@ -337,22 +355,24 @@
 			edButtons[edButtons.length] = btn;
 		}
 
-		if ( this.buttonsInitDone )
+		if ( this.buttonsInitDone ) {
 			this._buttonsInit(); // add the button HTML to all instances toolbars if addButton() was called too late
+		}
 	};
 
 	qt.insertContent = function(content) {
 		var sel, startPos, endPos, scrollTop, text, canvas = document.getElementById(wpActiveEditor);
 
-		if ( !canvas )
+		if ( !canvas ) {
 			return false;
+		}
 
 		if ( document.selection ) { //IE
 			canvas.focus();
 			sel = document.selection.createRange();
 			sel.text = content;
 			canvas.focus();
-		} else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { // FF, WebKit, Opera
+		} else if ( canvas.selectionStart || canvas.selectionStart === '0' ) { // FF, WebKit, Opera
 			text = canvas.value;
 			startPos = canvas.selectionStart;
 			endPos = canvas.selectionEnd;
@@ -419,7 +439,7 @@
 		var t = this, i = 0, ret = false;
 		if ( ed.openTags ) {
 			while ( ret === false && i < ed.openTags.length ) {
-				ret = ed.openTags[i] == t.id ? i : false;
+				ret = ed.openTags[i] === t.id ? i : false;
 				i ++;
 			}
 		} else {
@@ -434,10 +454,11 @@
 			canvas.focus();
 			sel = document.selection.createRange();
 			if ( sel.text.length > 0 ) {
-				if ( !t.tagEnd )
+				if ( !t.tagEnd ) {
 					sel.text = sel.text + t.tagStart;
-				else
+				} else {
 					sel.text = t.tagStart + sel.text + endTag;
+				}
 			} else {
 				if ( !t.tagEnd ) {
 					sel.text = t.tagStart;
@@ -450,7 +471,7 @@
 				}
 			}
 			canvas.focus();
-		} else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { // FF, WebKit, Opera
+		} else if ( canvas.selectionStart || canvas.selectionStart === '0' ) { // FF, WebKit, Opera
 			startPos = canvas.selectionStart;
 			endPos = canvas.selectionEnd;
 			cursorPos = endPos;
@@ -458,7 +479,7 @@
 			l = v.substring(0, startPos); // left of the selection
 			r = v.substring(endPos, v.length); // right of the selection
 			i = v.substring(startPos, endPos); // inside the selection
-			if ( startPos != endPos ) {
+			if ( startPos !== endPos ) {
 				if ( !t.tagEnd ) {
 					canvas.value = l + i + t.tagStart + r; // insert self closing tags after the selection
 					cursorPos += t.tagStart.length;
@@ -517,10 +538,11 @@
 				button = ed.getButton(tbo[tbo.length - 1]);
 				element = document.getElementById(ed.name + '_' + button.id);
 
-				if ( e )
+				if ( e ) {
 					button.callback.call(button, element, c, ed);
-				else
+				} else {
 					button.closeTag(element, ed);
+				}
 			}
 		}
 	};
@@ -540,16 +562,17 @@
 	qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) {
 		var URL, t = this;
 
-		if ( typeof(wpLink) != 'undefined' ) {
+		if ( typeof(wpLink) !== 'undefined' ) {
 			wpLink.open();
 			return;
 		}
 
-		if ( ! defaultValue )
+		if ( ! defaultValue ) {
 			defaultValue = 'http://';
+		}
 
 		if ( t.isOpen(ed) === false ) {
-			URL = prompt(quicktagsL10n.enterURL, defaultValue);
+			URL = window.prompt(quicktagsL10n.enterURL, defaultValue);
 			if ( URL ) {
 				t.tagStart = '<a href="' + URL + '">';
 				qt.TagButton.prototype.callback.call(t, e, c, ed);
@@ -568,9 +591,9 @@
 		if ( ! defaultValue ) {
 			defaultValue = 'http://';
 		}
-		var src = prompt(quicktagsL10n.enterImageURL, defaultValue), alt;
+		var src = window.prompt(quicktagsL10n.enterImageURL, defaultValue), alt;
 		if ( src ) {
-			alt = prompt(quicktagsL10n.enterImageDescription, '');
+			alt = window.prompt(quicktagsL10n.enterImageDescription, '');
 			this.tagStart = '<img src="' + src + '" alt="' + alt + '" />';
 			qt.TagButton.prototype.callback.call(this, e, c, ed);
 		}
@@ -581,26 +604,28 @@
 	};
 	qt.FullscreenButton.prototype = new qt.Button();
 	qt.FullscreenButton.prototype.callback = function(e, c) {
-		if ( !c.id || typeof(fullscreen) == 'undefined' )
+		if ( !c.id || typeof(fullscreen) === 'undefined' ) {
 			return;
+		}
 
 		fullscreen.on();
 	};
 
 	qt.TextDirectionButton = function() {
-		qt.Button.call(this, 'textdirection', quicktagsL10n.textdirection, '', quicktagsL10n.toggleTextdirection)
+		qt.Button.call(this, 'textdirection', quicktagsL10n.textdirection, '', quicktagsL10n.toggleTextdirection);
 	};
 	qt.TextDirectionButton.prototype = new qt.Button();
 	qt.TextDirectionButton.prototype.callback = function(e, c) {
-		var isRTL = ( 'rtl' == document.getElementsByTagName('html')[0].dir ),
+		var isRTL = ( 'rtl' === document.getElementsByTagName('html')[0].dir ),
 			currentDirection = c.style.direction;
 
-		if ( ! currentDirection )
+		if ( ! currentDirection ) {
 			currentDirection = ( isRTL ) ? 'rtl' : 'ltr';
+		}
 
-		c.style.direction = ( 'rtl' == currentDirection ) ? 'ltr' : 'rtl';
+		c.style.direction = ( 'rtl' === currentDirection ) ? 'ltr' : 'rtl';
 		c.focus();
-	}
+	};
 
 	// ensure backward compatibility
 	edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','b');
@@ -615,6 +640,6 @@
 	edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n','l'),
 	edButtons[110] = new qt.TagButton('code','code','<code>','</code>','c'),
 	edButtons[120] = new qt.TagButton('more','more','<!--more-->','','t'),
-	edButtons[140] = new qt.CloseButton()
+	edButtons[140] = new qt.CloseButton();
 
 })();
