Search code examples
javascriptinternet-explorer-8mason

Mason not working in IE8


I'm using Mason on my website. Everything is working fine, except IE8 (who would've guessed?).

The error it returns:

SCRIPT5007: Unable to get value of the property '1': object is null or undefined.

The line this error is triggered:

if( w >= settings.columns[colsCount][1]){

The colsCount returns '4' when the error occurs. When I test this in other browsers it only returns 3 max. I have tried to do minus 1, but that would give errors on multiple other lines.

I tested the demo that is included in the zipfile when you download it on Github, and even that one is failing in IE8. I have reported this issue as you can see on the Github, but I'd like to ask you guys for a quick solution, since my deadline for this project is quite soon.

I have tried multiple grids to achieve what I want, so trying another one like Masonry and Isotope is out of the question. (They don't provide what the client wants).

Thanks for looking in to this!


Solution

  • In the fluid page there are several script errors with trailing comma's: layout: 'fluid' had an extra comma that causes a script error and sizes

    var sizes= [
                        [1,1],
                        [1,2],
                        [2,2],
                    ]
    console.log(sizes.length)//=3 in ff and 4 in IE
    

    No need to change the library but change the calling code.