Windows 7 ie10 issue
There seems to be an issue with pages using selectboxit in ie10 on windows 7. its fine in windows 8. any ideas?
What are the issues you are seeing on IE10 on Windows 7?
it stops the page from loading. i'm using the basic call
$("select").selectBoxIt();
hi a bit more info.
i'm using the latest version and downloaded the full repository (v3.4.0 ). if you try to view the demo in ie 10 on windows 7 you get a black browser. i've used version 2.9 on projects in the past and these work across all browsers including ie10
I just tried the demo inside of Windows 7 IE 10 and it seems to work fine. Do you see any JavaScript errors being thrown?
I am closing this right now because I don't see an issue on IE10, but I will reopen it if you can show me that there is.
@gfranko I can confirm that selectBoxIt crashes IE10, but not directly. It somehow spoils the document.getElementsByName() method and as soon as this method is called - browser crashes.
The easier way to reproduce is to initialize selectBoxIt and then call from the console document.getElementsByName('qwe').
This issues is not reproducible in emulation mode of IE11. But easily reproducible on VM running IE10 on Windows 7. We were not able to reproduce that in IE9 or IE8, but we haven't tested them a lot.
Confirmed. We just had a client that reported a crash in IE10 when submitting a form, and we quickly tracked the crash down to selectBoxIt.
Running document.getElementsByName('qwe'), as you suggested @aboritskiy, reproduces the crash.
Let me know if you find any workarounds.
I can confirm the same. I'm running IE10.0.15 on Win8. After initializing selectBoxIt, any call to getElementsByName will cause to IE to crash. It'll close with a "Internet Explorer has stopped working" popup.
All other browsers are fine.
I'm looking into this right now. Not fun to debug lol.
I'm not sure why this is happening, but if you add a name attribute to each of your select boxes, the problem goes away. Will continue to look into this.
Confirmed, thanks a lot! This fixes the crash for me.
@gfranko, consider adding such code to seletBoxIT
/**
* Generates names for select boxes in case they are empty. Attempts to use id as a name if id is set.
*
* @param {jQuery} $selects
*/
var generateSelectBoxNames = function ($selects) {
$selects.each(function (iIndex) {
var $this = $(this);
var sName = $this.attr('name');
var sId = $this.attr('id');
if (typeof sName !== 'undefined' && sName.length > 0) {
/* nothing to do here */
return;
}
if (typeof sId !== 'undefined' && sId.length > 0) {
/* use id as name */
$this.attr('name', sId);
return;
}
$this.attr('name', 'select-box-' + iIndex);
});
};
This code fixed the issue for me.
@aboritskiy Interesting, thanks!
Hi,
if you are talking about this fix:
/**
-
Generates names for select boxes in case they are empty. Attempts to use id as a name if id is set. *
-
@param {jQuery} $selects / var generateSelectBoxNames = function ($selects) { $selects.each(function (iIndex) { var $this = $(this); var sName = $this.attr('name'); var sId = $this.attr('id'); if (typeof sName !== 'undefined' && sName.length > 0) { / nothing to do here */ return; }
if (typeof sId !== 'undefined' && sId.length > 0) { /* use id as name */ $this.attr('name', sId); return; } $this.attr('name', 'select-box-' + iIndex);}); }; then just before or after calling select-box-it, call this method passing the jQuery collection with your selects as an argument. Smth like this:
var $selects = $('select'); $selects.selectBoxIt(); generateSelectBoxNames($selects); This fixes the problem because IE has some troubles with select fields without name attribute. When your select field has name - you are safe.
Best regards, Anton Boritskiy
Fri, 14 Nov 2014 11:48:05 -0800 от manuferre [email protected]:
Hi, @gfranko , @aboritskiy , I downloaded the lastest version of the selectBoxIt.js but the bug is still there, How can I implement the fix? editing directly the code?, in what lines? Thanks a lot in advance — Reply to this email directly or view it on GitHub .
Thanks @aboritskiy & @gfranko