Skip to content

Commit 1619b1f

Browse files
committed
Escape html characters - optgroup label
1 parent 2489720 commit 1619b1f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/jquery.multiselect.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@
152152

153153
// has this optgroup been added already?
154154
if($.inArray(optLabel, optgroups) === -1) {
155-
html += '<li class="ui-multiselect-optgroup-label ' + parent.className + '"><a href="#">' + optLabel + '</a></li>';
155+
var optLabelEscaped = optLabel.replace(/&/g, '&amp;')
156+
.replace(/>/g, '&gt;')
157+
.replace(/</g, '&lt;')
158+
.replace(/'/g, '&#39;')
159+
.replace(/\//g, '&#x2F;')
160+
.replace(/"/g, '&quot;');
161+
html += '<li class="ui-multiselect-optgroup-label ' + parent.className + '"><a href="#">' + optLabelEscaped + '</a></li>';
156162
optgroups.push(optLabel);
157163
}
158164
}

0 commit comments

Comments
 (0)