imthenachoman / nSPTiles

Windows style tiles for SharePoint
http://nsptiles.js.org
MIT License
11 stars 5 forks source link

issue with the tile not rendered check #5

Closed Sporadius closed 7 years ago

Sporadius commented 7 years ago

There seems to be an issue with the tile not rendered check. When using this function the script will fail in IE10 and IE11 (IE9, Firefox and Chrome are fine) Seems to be related to the XML query used on line 1046 in the script. Are you aware and do you have a solution? (looking into this myself as well because I need it)

XPathResult is not defined

imthenachoman commented 7 years ago

@Sporadius I am not aware of this issue. Let me look into it.

Sporadius commented 7 years ago

Hi, I have found a solution for IE 8,9,10,11, Edge, Chrome, Firefox. Actually like this:

row 1029: // detect how to handle XML query in the browser var xmldoc; var isIE; try { //IE detected xmldoc = new ActiveXObject('Microsoft.XMLDOM'); xmldoc.loadXML(xhr.responseText); isIE = true; } catch (e) { //Chrome, Firefox other browser isIE = false; }

        // are there rows
        if(rows.length)
        {
            // we need to know the max right and bottom so we know how big the container is
            var maxRightEdge = -1;
            var maxBottomEdge = -1;

            // loop through each tile
            for(var i = 0, num = rows.length; i < num; ++i)
            {
                var row = rows[i];

                var nTileNotRenderedCheck = row.getAttribute("ows_nTileNotRenderedCheck");

                if(nTileNotRenderedCheck)
                {
                    if (isIE)
                    {
                        if(xmldoc.selectSingleNode("//z:row[@ows_ID='" + parseInt(nTileNotRenderedCheck) + "']")) continue;
                    }
                    else
                    { 
                        if(xhr.responseXML.evaluate("count(//z:row[@ows_ID='" + parseInt(nTileNotRenderedCheck) + "'])", xhr.responseXML, function(ns){return "#RowsetSchema";}, XPathResult.ANY_TYPE, null).numberValue > 0) continue;
                    }
                }

Let me know what you think about this.

imthenachoman commented 7 years ago

I always hated IE cause it does stuff like this.

But this looks great. Does it work? If so I'll add it to my code. It'll be a few weeks. Just had a baby so I'll need some time to catch up.

imthenachoman commented 7 years ago

@Sporadius What is the error you get BTW?

Sporadius commented 7 years ago

Hi congratulations with your baby! XPathResult is not defined was the error, actually IE10/11 is trying to execute the Chrome code and it can't.

essineden commented 7 years ago

Congratulations @imthenachoman ! :)

With regards to this issue, does that mean that FontAwesome will also be compatible with IE8/11? I'm having a hard time making it work in IE.

-- even though I hate IE :-1:

imthenachoman commented 7 years ago

@essineden No. FA should work fine. It has worked in all my tests. Do you have the FA references working? I would test FA on the page without the tiles to make sure it works and then try it on the tiles.

imthenachoman commented 7 years ago

@Sporadius Thank you for this. I found a fix that works. I basically have to get an XML doc that I can run an XPATH query against

try
{
    var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
    xmlDoc.loadXML(xhr.responseText); 
}
catch(e)
{
    var xmlDoc = xhr.responseXML;
}
imthenachoman commented 7 years ago

Fixed in v1.51