From fda3f516c0917b5a9c280c818339c11d39230dfd Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 24 Jul 2019 09:47:16 +0800 Subject: [PATCH] =?UTF-8?q?BI-48487=20refactor:=20=E5=A4=9A=E9=9F=B3?= =?UTF-8?q?=E5=AD=97=E6=A0=87=E7=BA=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- karma.conf.js | 2 +- src/core/platform/web/jquery/fn.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index a54a552bb..8c1c2e24d 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -58,7 +58,7 @@ module.exports = function (config) { "src/core/alias.js": "coverage", "src/core/base.js": "coverage", "src/core/func/date.js": "coverage", - "src/base/**/*.js": "coverage" + "src/base/**/!(*.test).js": "coverage" }, diff --git a/src/core/platform/web/jquery/fn.js b/src/core/platform/web/jquery/fn.js index 5ecf47eed..a18ad38a6 100644 --- a/src/core/platform/web/jquery/fn.js +++ b/src/core/platform/web/jquery/fn.js @@ -84,7 +84,9 @@ if (jQuery) { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) {