Index: src/wp-includes/js/shortcode.js
===================================================================
--- src/wp-includes/js/shortcode.js	(revision 28188)
+++ src/wp-includes/js/shortcode.js	(working copy)
@@ -34,15 +34,16 @@
 				shortcode: wp.shortcode.fromMatch( match )
 			};
 
-			// If we matched a leading `[`, strip it from the match
-			// and increment the index accordingly.
-			if ( match[1] ) {
+			// If we matched a leading `[`, and it has a matching counterpart,
+			// strip it from the match and increment the index accordingly.
+			if ( match[1] && typeof result.match !== 'undefined' ) {
 				result.match = result.match.slice( 1 );
 				result.index++;
 			}
 
-			// If we matched a trailing `]`, strip it from the match.
-			if ( match[7] ) {
+			// If we matched a trailing `]`, , and it has a matching counterpart,
+			// strip it from the match.
+			if ( match[7] && typeof result.match !== 'undefined' ) {
 				result.match = result.match.slice( 0, -1 );
 			}
 
@@ -353,4 +354,4 @@
 			return text + '</' + options.tag + '>';
 		}
 	});
-}());
\ No newline at end of file
+}());
Index: tests/qunit/wp-includes/js/shortcode.js
===================================================================
--- tests/qunit/wp-includes/js/shortcode.js	(revision 28188)
+++ tests/qunit/wp-includes/js/shortcode.js	(working copy)
@@ -57,10 +57,30 @@
 		equal( result, undefined, 'foo shortcode not found when escaped with params' );
 	});
 
+	test( 'next() should find shortcodes that are incorrectly escaped by newlines', function() {
+		var result;
+
+		result = wp.shortcode.next( 'foo', 'this has the [\n[foo]] shortcode' );
+		equal( result.index, 15, 'shortcode found when incorrectly escaping the start of it' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [[foo]\n] shortcode' );
+		equal( result.index, 13, 'shortcode found when incorrectly escaping the end of it' );
+
+	});
+
+	test( 'next() should still work when there are not equal ammounts of square brackets', function() {
+		var result;
+
+		result = wp.shortcode.next( 'foo', 'this has the [[foo] shortcode' );
+		equal( result.index, 13, 'shortcode found when there are offset square brackets' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [foo]] shortcode' );
+		equal( result.index, 13, 'shortcode found when there are offset square brackets' );
+	});
+
 	test( 'next() should find the second instances of the shortcode when the first one is escaped', function() {
 		var result;
 
-
 		result = wp.shortcode.next( 'foo', 'this has the [[foo]] shortcode [foo] twice' );
 		equal( result.index, 31, 'foo shortcode found the non-escaped foo at index 31' );
 	});
@@ -121,8 +141,20 @@
 
 		result = wp.shortcode.replace( 'foo', 'this [foo] has the [[foo param="bar"]] shortcode escaped', shortcodeReplaceCallback );
 		equal( result, 'this bar has the [[foo param="bar"]] shortcode escaped', 'escaped foo with params not replaced but unescaped foo replaced' );
+
 	});
 
+	test( 'replace() should replace improperly escaped shortcodes that include newlines', function() {
+		var result;
+
+		result = wp.shortcode.replace( 'foo', 'this [foo] has the [[foo param="bar"]\n] shortcode ', shortcodeReplaceCallback );
+		equal( result, 'this bar has the [bar\n] shortcode ', 'escaping with newlines should not actually escape the content' );
+
+
+		result = wp.shortcode.replace( 'foo', 'this [foo] has the [\n[foo param="bar"]] shortcode ', shortcodeReplaceCallback );
+		equal( result, 'this bar has the [\nbar] shortcode ', 'escaping with newlines should not actually escape the content' );
+	});
+
 	test( 'replace() should not replace the shortcode when it is an incomplete match', function() {
 		var result;
 
