Skip to content

Commit 0dd3252

Browse files
authored
Merge pull request #66 from segment-oj/add-replace-all-for-all-browser-szdytom
fix replaceall
2 parents 6a22728 + 6bd0ca4 commit 0dd3252

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/StringPrototype.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ if (String.prototype.replaceAll === undefined) {
22
String.prototype.replaceAll = function (before, after) {
33
let res = new String(), matched = 0;
44
for (let i = 0; i < this.length; i += 1) {
5-
if (this[i] == before[matched]) {
5+
if (this[i] === before[matched]) {
66
matched += 1;
7-
if (matched == before.length) {
7+
if (matched === before.length) {
88
res += after;
99
matched = 0;
1010
}
@@ -13,6 +13,11 @@ if (String.prototype.replaceAll === undefined) {
1313
res += this[i];
1414
}
1515
}
16+
17+
for (let i = this.length - matched; i < this.length; i += 1) {
18+
res += this[i];
19+
}
20+
1621
return res;
1722
};
1823
}

src/components/user/register.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<el-form-item prop="passwdrepeat">
1515
<el-input type="password" v-model="ldata.passwdrepeat"></el-input>
1616
</el-form-item>
17-
<div class="icon-lable"><i class="el-icon-message" /> Email</div>
17+
<div class="icon-lable form-required"><i class="el-icon-message" /> Email</div>
1818
<el-form-item prop="email">
1919
<el-input type="email" v-model="ldata.email"></el-input>
2020
</el-form-item>

0 commit comments

Comments
 (0)