Merge "UnicodeJS treating start/end tags as letters"

This commit is contained in:
jenkins-bot 2013-05-18 16:49:53 +00:00 committed by Gerrit Code Review
commit 17642a3f14
2 changed files with 8 additions and 2 deletions

View file

@ -23,6 +23,12 @@
} }
function getGroup( chr ) { function getGroup( chr ) {
// chr is always converted to a string by RegExp#test
// e.g. null -> 'null' and would match /[a-z]/
// so return null for any non-string value
if ( typeof chr !== 'string' ) {
return null;
}
var group; var group;
for ( group in patterns ) { for ( group in patterns ) {
if ( patterns[group].test( chr ) ) { if ( patterns[group].test( chr ) ) {

View file

@ -22,7 +22,7 @@ QUnit.test( 'isBreak', function ( assert ) {
// 40 - 50 // 40 - 50
"汉字/漢字 c\u0300\u0327k" + "汉字/漢字 c\u0300\u0327k" +
// 50 - 60 // 50 - 60
" c\u0300\u0327", " c\u0300\u0327 a.",
/*jshint quotmark:single */ /*jshint quotmark:single */
textString = new unicodeJS.TextString( text ), textString = new unicodeJS.TextString( text ),
breaks = [ breaks = [
@ -31,7 +31,7 @@ QUnit.test( 'isBreak', function ( assert ) {
21, 25, 30, 21, 25, 30,
31, 39, 40, 31, 39, 40,
41, 42, 43, 44, 45, 46, 50, 41, 42, 43, 44, 45, 46, 50,
51, 54 51, 54, 55, 56, 57
]; ];
QUnit.expect( text.length + 1 ); QUnit.expect( text.length + 1 );