Skip to content

Commit abc0e6c

Browse files
authored
Merge pull request #2276 from IgniteUI/sstoychev/make-replacements-opt
fix(util): making some polyfills polyfills
2 parents 940e46a + 08da31c commit abc0e6c

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/js/modules/infragistics.util.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3769,9 +3769,11 @@
37693769
return ret;
37703770
});
37713771

3772-
String.prototype.startsWith = function (s) {
3773-
return this.indexOf(s) === 0;
3774-
};
3772+
if (!String.prototype.startsWith) {
3773+
String.prototype.startsWith = function (s) {
3774+
return this.indexOf(s) === 0;
3775+
};
3776+
}
37753777

37763778
String.prototype.startsWith1 = function (s, comparisonType) {
37773779
if (this.length < s.length) {
@@ -3781,13 +3783,15 @@
37813783
return $.ig.util.stringCompare1(this.slice(0, s.length), s, comparisonType || 0) === 0;
37823784
};
37833785

3784-
String.prototype.endsWith = function (s, comparisonType) {
3785-
if (this.length < s.length) {
3786-
return false;
3787-
}
3786+
if (!String.prototype.endsWith) {
3787+
String.prototype.endsWith = function (s, comparisonType) {
3788+
if (this.length < s.length) {
3789+
return false;
3790+
}
37883791

3789-
return $.ig.util.stringCompare1(this.slice(-s.length), s, comparisonType || 0) === 0;
3790-
};
3792+
return $.ig.util.stringCompare1(this.slice(-s.length), s, comparisonType || 0) === 0;
3793+
};
3794+
}
37913795

37923796
String.prototype.remove = function (index, count) {
37933797
if (!count || ((index + count) > this.length)) {

0 commit comments

Comments
 (0)