Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.test.js |
— | — | @@ -138,9 +138,18 @@ |
139 | 139 | mw.test.addTest( 'typeof $.escapeRE', |
140 | 140 | 'function (string)' ); |
141 | 141 | |
142 | | - mw.test.addTest( '$.escapeRE( ".st{e}$st" )', |
143 | | - '\\.st\\{e\\}\\$st (string)' ); |
| 142 | + mw.test.addTest( '$.escapeRE( "<!-- ([{+mW+}]) $^|?>" )', |
| 143 | + '<!\\-\\- \\(\\[\\{\\+mW\\+\\}\\]\\) \\$\\^\\|\\?> (string)' ); // double escaped |
144 | 144 | |
| 145 | + mw.test.addTest( '$.escapeRE( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" )', |
| 146 | + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ (string)' ); |
| 147 | + |
| 148 | + mw.test.addTest( '$.escapeRE( "abcdefghijklmnopqrstuvwxyz" )', |
| 149 | + 'abcdefghijklmnopqrstuvwxyz (string)' ); |
| 150 | + |
| 151 | + mw.test.addTest( '$.escapeRE( "0123456789" )', |
| 152 | + '0123456789 (string)' ); |
| 153 | + |
145 | 154 | mw.test.addTest( 'typeof $.isEmpty', |
146 | 155 | 'function (string)' ); |
147 | 156 | |
Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | return str.substr( 0, 1 ).toUpperCase() + str.substr( 1, str.length ); |
16 | 16 | }, |
17 | 17 | escapeRE : function( str ) { |
18 | | - return str.replace ( /([\\{}()|.?*+-\^$\[\]])/g, "\\$1" ); |
| 18 | + return str.replace ( /([\\{}()|.?*+\-^$\[\]])/g, "\\$1" ); |
19 | 19 | }, |
20 | 20 | // $.isDomElement( document.getElementById('content') ) === true |
21 | 21 | // $.isDomElement( document.getElementsByClassName('portal') ) === false (array) |