Skip to content
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 potential xss attack #730

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/js/bootstrap-switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ class BootstrapSwitch {
});
this.$container = $('<div>', { class: this::prvgetClass('container') });
this.$on = $('<span>', {
html: this.options.onText,
text: this.options.onText,
class: `${this::prvgetClass('handle-on')} ${this::prvgetClass(this.options.onColor)}`,
});
this.$off = $('<span>', {
html: this.options.offText,
text: this.options.offText,
class: `${this::prvgetClass('handle-off')} ${this::prvgetClass(this.options.offColor)}`,
});
this.$label = $('<span>', {
html: this.options.labelText,
text: this.options.labelText,
class: this::prvgetClass('label'),
});

Expand Down Expand Up @@ -473,7 +473,7 @@ class BootstrapSwitch {

onText(value) {
if (typeof value === 'undefined') { return this.options.onText; }
this.$on.html(value);
this.$on.text(value);
this::prvwidth();
this::prvcontainerPosition();
this.options.onText = value;
Expand All @@ -482,7 +482,7 @@ class BootstrapSwitch {

offText(value) {
if (typeof value === 'undefined') { return this.options.offText; }
this.$off.html(value);
this.$off.text(value);
this::prvwidth();
this::prvcontainerPosition();
this.options.offText = value;
Expand All @@ -491,7 +491,7 @@ class BootstrapSwitch {

labelText(value) {
if (typeof value === 'undefined') { return this.options.labelText; }
this.$label.html(value);
this.$label.text(value);
this::prvwidth();
this.options.labelText = value;
return this.$element;
Expand Down Expand Up @@ -598,7 +598,7 @@ $.fn.bootstrapSwitch.defaults = {
offColor: 'default',
onText: 'ON',
offText: 'OFF',
labelText: '&nbsp',
labelText: '\xa0',
handleWidth: 'auto',
labelWidth: 'auto',
baseClass: 'bootstrap-switch',
Expand Down