-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
[Dropdown] Values are parsed incorrectly when they contain <, ≤, etc #1207
Comments
EDIT: Read next comment, this does work in some cases but there is another case I had not found until after I had written this one. If anyone needs a workaround to fix this, I made a little function that will decode the values: let decodeEntity = (text, iterations) => {
iterations = iterations || 10;
for(let i = 0; i < iterations; i++) {
text = $("<div/>").html(text).text();
}
return text;
} You pass it the text with HTML entities in it and the number of iterations. The second argument is the amount of times to decode the text, since the values are encoded every change it seems you have to do it the amount of changes the dropdown has had, since the old values will not be removed. The values array is still kinda buggy. let decode_iterations = 0;
$('.ui.dropdown').dropdown({
onChange: val => {
decode_iterations++;
}
});
let values = $('.ui.dropdown').dropdown('get values').map(val => decodeEntity(val, decode_iterations));
console.log(values); |
I think this is also messing with the changing logic, when a value is removed it can't find any match in the values for This also highlights that the elements are further encoded, so I will modify the above decoding function to more accurately decode based on the number of changes, even if there is a larger problem relating to the values not being removed. I would say that using |
Fixed by #1210 . See your adjusted jsfiddle here https://jsfiddle.net/kjqoa89e/ |
@GammaGames I also fixed the remove label issue now |
Bug Report
Steps to reproduce
<
,>
,≤
, and≥
Expected result
Get the values for
<
and companyActual result
Get
&;amp;amp;amp;lt;
and company. The number of&
might be related to number of selected values?Testcase
https://jsfiddle.net/4cqtnf0d/
Screenshot (when possible)
Version
2.8.2
The text was updated successfully, but these errors were encountered: