jQuery UI Widgets Forums General Discussions e.access is not a function

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  admin 5 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • e.access is not a function #133995

    marsovac
    Participant

    I am using the latest version of jqWidgets and jQuery 3.6.0

    It seems that jqWudgets it throwing exceptions inside itself on the following code when trying to call e.access:

    
    html: function(t, i) {
                if (!e(t).on)
                    return e(t).html(i);
                try {
                    return e.access(t, (function(i) {
                        var s = t[0] || {}
                          , n = 0
                          , r = t.length;
                        if (void 0 === i)
                            return 1 === s.nodeType ? s.innerHTML.replace(rinlinejQuery, "") : void 0;
                        var o = new RegExp("<(?:abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)[\\s/>]","i");
                        if ("string" == typeof i && !/<(?:script|style|link)/i.test(i) && (e.support.htmlSerialize || !o.test(i)) && (e.support.leadingWhitespace || !/^\s+/.test(i)) && !{
                            option: [1, "<select multiple='multiple'>", "</select>"],
                            legend: [1, "<fieldset>", "</fieldset>"],
                            thead: [1, "<table>", "</table>"],
                            tr: [2, "<table><tbody>", "</tbody></table>"],
                            td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
                            col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
                            area: [1, "<map>", "</map>"],
                            _default: [0, "", ""]
                        }[(/<([\w:]+)/.exec(i) || ["", ""])[1].toLowerCase()]) {
                            i = i.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, "<$1></$2>");
                            try {
                                for (; n < r; n++)
                                    1 === (s = this[n] || {}).nodeType && (e.cleanData(s.getElementsByTagName("*")),
                                    s.innerHTML = i);
                                s = 0
                            } catch (e) {}
                        }
                        s && t.empty().append(i)
                    }
                    ), null, i, arguments.length)
                } catch (s) {
                    return e(t).html(i)
                }
            },
    

    This exception seems to be swallowed, but if I put a breakpoint there I can see it is trying to call a jquery access funtion which does not exists.
    But if this happenes often enough the browser window can crash with Access violation. (Edge)
    I have found a topic that might be related to this: https://github.com/jquery/jquery/issues/2513
    If a function was rmeoved from jQuery, trying to call it repeatedly throwing ecceptions and then falling back to calling e(t).html(i) makes no sense. If the function does not exists just don’t call it!

    This .access is uses everywhere, in jq core as well and in widgets. It is doing thousands of exceptions all the time, just handled, and this is killing browsers.

    I have other issues as well perhaps related to this.
    Can somebody tell me which version of jQuery do I need for the latest version of jqWidgets?

    • This topic was modified 5 months, 3 weeks ago by  marsovac.
    • This topic was modified 5 months, 3 weeks ago by  marsovac.
    • This topic was modified 5 months, 3 weeks ago by  marsovac.
    • This topic was modified 5 months, 3 weeks ago by  marsovac.
    e.access is not a function #134000

    admin
    Keymaster

    Hi marsovac,

    Could you share a sample which reproduces this?

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    e.access is not a function #134003

    marsovac
    Participant

    A minimal sample is to just use a jqxDrowdownList with items with jQuery 3.6.0.
    You wont get any exception because this is caught inside jqWidgets and then it falls back to “e(t).html(i)”.
    But it is a serious performance and stability problem when you have many items and many dropdowns.

    Simply put jqWidgets should never call a function that it assumes exists.
    The assumption here is that you have “.access()” when you have “.on()”.
    This is no longer true for quite some time in jQuery.

    The apropriate thing to do would be to check if “.access” exists and is a function before calling it.

    You can also enable “Pause on caught exceptions” in the chrome/edge dev tools and you will see that you jump to this place where it calls “access” which does not exists.

    Since .html() is called for each item to draw it you will get thousands of these when you have a complex ui with a lot of items in dropodowns.

    But this same asumptions is being done in many places in jqWidgets, not only in jqxDropdown, basically everywhere it wants to render the html for something. Even in jq.core.

    • This reply was modified 5 months, 3 weeks ago by  marsovac.
    • This reply was modified 5 months, 3 weeks ago by  marsovac.
    • This reply was modified 5 months, 3 weeks ago by  marsovac.
    e.access is not a function #134008

    admin
    Keymaster

    Hi marsovac,

    Thanks for the additional details and feedback! Indeed that could result in a performance issue and we will resolve it.

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.