Code Monkey home page Code Monkey logo

Comments (2)

 avatar commented on August 28, 2024

Hi Allan,

I wanted to get this working and because my "events" issues were worse than the "not working w/ jQuery v2.0", I went ahead and found a solution. I haven't fully debug it, but it seems to work as best I can tell:

    // jQuery 1.9+
    VE.parsers.push(function () {
        var version = $.fn.jquery.substr(0, 3),
            elements = [],
            count = 0;

        msos.console.debug('VE.parsers.push -> 1.9+ start, ver: ' + version);

        version = Number(version);

        if (!$ || version < 1.9) {
            msos.console.debug('VE.parsers.push -> 1.9+ done, none!');
            return [];
        }

        $('*').each(
            function () {
                count += 1;

                var html_el_data = $._data($(this).get(0)) || null,
                    i = '',
                    j = '',
                    type = '',
                    k = 0,
                    kLen = 0,
                    func = null,
                    eventAttachedNode,
                    oEvents,
                    aNodes = [],
                    sjQuery = '';

                    if (typeof html_el_data.events == 'object') {

                        eventAttachedNode = html_el_data.handle.elem || {};
                        func = null;

                    for (type in html_el_data.events) {

                        if (type !== 'live') {

                            oEvents = html_el_data.events[type] || {};

                            for (j in oEvents) {
                                aNodes = [];
                                sjQuery = "jQuery " + $.fn.jquery;

                                if (oEvents[j].selector !== undefined && oEvents[j].selector !== null) {
                                    aNodes = $(oEvents[j].selector, cache[i].handle.elem);
                                    sjQuery += " (live event)";
                                } else {
                                    aNodes.push(eventAttachedNode);
                                }

                                kLen = aNodes.length;

                                for (k = 0; k < kLen; k += 1) {
                                    elements.push(
                                        {
                                            "node": aNodes[k],
                                            "listeners": []
                                        }
                                    );

                                    if (oEvents[j].origHandler !== undefined) {
                                        func = oEvents[j].origHandler.toString();
                                    } else if (oEvents[j].handler !== undefined) {
                                        func = oEvents[j].handler.toString();
                                    } else {
                                        func = oEvents[j].toString();
                                    }

                                    /* We use jQuery for the Visual Event events... don't really want to display them */
                                    if (oEvents[j] && oEvents[j].namespace !== "VisualEvent" && func !== "0") {
                                        elements[elements.length - 1].listeners.push(
                                            {
                                                "type": type,
                                                "func": func,
                                                "removed": false,
                                                "source": sjQuery
                                            }
                                        );
                                    }
                                }

                                // Remove elements that didn't have any listeners (i.e. might be a Visual Event node)
                                if (elements[elements.length - 1].listeners.length === 0) {
                                    elements.splice(elements.length - 1, 1);
                                }
                            }
                        }
                    }
                }
            }
        );

It isn't "drop in place" for your VisualEvent.parser code, but you can probably figure it out. Thanks for the reply to my email.

from visualevent.

 avatar commented on August 28, 2024

Thanks to KoalaBear84's work here #34 - it does now. I'm just about to do a build and deploy with the fix.

from visualevent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.