davidstutz / bootstrap-multiselect

JQuery multiselect plugin based on Twitter Bootstrap.
https://davidstutz.github.io/bootstrap-multiselect/
Other
3.67k stars 1.98k forks source link

option.class giving us a error #812

Closed josebermudez closed 6 years ago

josebermudez commented 8 years ago

IE 8 error. We are using the http://yui.github.io/yuicompressor/ and option.class giving us a error and IE8

1481:46:missing name after . operator

We think that for compatibility must be used option['class'] fireshot screen capture 148 - refresh-sf - online javascript and css compressor - refresh-sf_com

farhad-tarapore commented 8 years ago

Yes, I got the same thing

java -jar ~/Downloads/yuicompressor-2.4.8.jar bootstrap-multiselect.js -o bootstrap-multiselect.min.js [ERROR] in bootstrap-multiselect.js 1430:30:invalid property id [ERROR] in bootstrap-multiselect.js 1430:31:syntax error [ERROR] in bootstrap-multiselect.js 1431:34:syntax error [ERROR] in bootstrap-multiselect.js 1432:34:syntax error [ERROR] in bootstrap-multiselect.js 1433:22:syntax error [ERROR] in bootstrap-multiselect.js 1:0:Compilation produced 5 syntax errors.

deepak-prabhu-jabong commented 7 years ago

I got the similar error..After I commenting out the below attributes it worked.. Seems like syntax errors ... double exclamation is included in the code

var attributes = { 'value': option.value, 'label': option.label || option.value, 'title': option.title //'class': option.class //'selected': !!option.selected, //'disabled': !!option.disabled };

demartis commented 7 years ago

![Uploading Screen Shot 2017-02-20 at 12.48.04.png…]() I got the same error, "class" is a reserved word in ECMAScript 5 and 6. I resolved accessing to this properties with:

     var attributes = {
                    'value': option.value,
                    'label': option.label || option.value,
                    'title': option.title,
                    'class': option['class'],
                    'selected': !!option['selected'],
                    'disabled': !!option['disabled']
                };
smidgen commented 7 years ago

I got the same error, solved it the same way @demartis did. This is the way to do it without risking loss of functionality.

Normally I don't care about IE8, but we have to contact our client and get them to agree before we can drop IE8 support. Since this is an extremely simple fix, it's worth the effort.

davidstutz commented 6 years ago

Fixed by merging #862.