-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix missing spaces in RichText #5116
Conversation
no need to add equal sign
add code comments before using substring
make meaning of parameter fuzzyLen easier to understand
因为单词换行需要向前缩进,左边的空格需要去除,同时因为在处理带标签文本的时候会单独提取出来,导致带标签文本前面的空格会算在之前的字符串段内,在执行 trim() 的时候会删除掉空格串,所以这里将 trim() 改为了 trimLeft() ,并在 polyfill 中添加了某些不兼容该方法的浏览器对该方法的兼容。 |
has made code style better
polyfill/string.js
Outdated
|
||
if (!String.prototype.trimLeft) { | ||
String.prototype.trimLeft = function () { | ||
return this.replace(/^\s+/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要 /g 吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要 /g 吧?
这里的语义只匹配一次确实不需要 /g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要 /g 吧?
已修改
no need of 'g'
Re: cocos-creator/2d-tasks#1646
Changes: