Skip to content

Commit ddbdecb

Browse files
committed
Squashed commit of the following:
commit bb69ace Author: Justin Cooper <[email protected]> Date: Thu Jul 30 15:37:50 2020 -0500 fix potential xss attack
1 parent 95dcb54 commit ddbdecb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/js/bootstrap-switch.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,15 @@ class BootstrapSwitch {
290290
});
291291
this.$container = $('<div>', { class: this::prvgetClass('container') });
292292
this.$on = $('<span>', {
293-
html: this.options.onText,
293+
text: this.options.onText,
294294
class: `${this::prvgetClass('handle-on')} ${this::prvgetClass(this.options.onColor)}`,
295295
});
296296
this.$off = $('<span>', {
297-
html: this.options.offText,
297+
text: this.options.offText,
298298
class: `${this::prvgetClass('handle-off')} ${this::prvgetClass(this.options.offColor)}`,
299299
});
300300
this.$label = $('<span>', {
301-
html: this.options.labelText,
301+
text: this.options.labelText,
302302
class: this::prvgetClass('label'),
303303
});
304304

@@ -473,7 +473,7 @@ class BootstrapSwitch {
473473

474474
onText(value) {
475475
if (typeof value === 'undefined') { return this.options.onText; }
476-
this.$on.html(value);
476+
this.$on.text(value);
477477
this::prvwidth();
478478
this::prvcontainerPosition();
479479
this.options.onText = value;
@@ -482,7 +482,7 @@ class BootstrapSwitch {
482482

483483
offText(value) {
484484
if (typeof value === 'undefined') { return this.options.offText; }
485-
this.$off.html(value);
485+
this.$off.text(value);
486486
this::prvwidth();
487487
this::prvcontainerPosition();
488488
this.options.offText = value;
@@ -491,7 +491,7 @@ class BootstrapSwitch {
491491

492492
labelText(value) {
493493
if (typeof value === 'undefined') { return this.options.labelText; }
494-
this.$label.html(value);
494+
this.$label.text(value);
495495
this::prvwidth();
496496
this.options.labelText = value;
497497
return this.$element;
@@ -598,7 +598,7 @@ $.fn.bootstrapSwitch.defaults = {
598598
offColor: 'default',
599599
onText: 'ON',
600600
offText: 'OFF',
601-
labelText: '&nbsp',
601+
labelText: '\xa0',
602602
handleWidth: 'auto',
603603
labelWidth: 'auto',
604604
baseClass: 'bootstrap-switch',

0 commit comments

Comments
 (0)