Git Product home page Git Product logo

events.js's People

Contributors

davidyu avatar kbjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

events.js's Issues

type error if calling Events.unbind before Events.bind

On Chrome and Safari (and possibly other browsers, but I haven't tried), with the following snippet of code, I run into a type error.

Code:

Events.ready( function() {
  Events.unbind( window, "resize" );
  Events.bind( window, "resize", function() { console.log( "I'm handling it." ); } );
} );

Error (Chrome):

Uncaught TypeError: Cannot read property 'removeNamespace' of undefined
self2.removeEvent                                            events.js:929
self.unbind                                                  events.js:1203

If I call Events.unbind after Events.bind, this issue no longer occurs.

Also, if I change line 929:

        // Remove the namespace
        events[event].removeNamespace(segments);

to

        // Remove the namespace
        if (events[event] !== undefined) { events[event].removeNamespace(segments); }

The error goes away.

Great work on the library!

mouseleave behave like mouseout

You code seem to replace mouseleave with mouseout, witch is bad. If you have child element in the element you binded the event to, mouseout will trigger for every child as well as the targeted element. Mouseleave fix that and trigger only one when you exit the element you binded the event on.

removing this code fix the issue for me :

    mouseenter: {
        attachesTo: 'mouseover',
        eventTest: function(evt) {
            return (! withinElement(evt, evt.originalTarget(), 'fromElement'));
        }
    },
    mouseleave: {
        attachesTo: 'mouseout',
        eventTest: function(evt) {
            return (! withinElement(evt, evt.originalTarget(), 'toElement'));
        }
    },

why is this there?

browser compatibility

i just test it on IE 6, and its not work,
could you making it to support IE 6, and other browser?
i like this framework,
hope you can make it compatible with other browser

thx

Ender support

Title kinda says it all, I would like to have it included in the NPM :)

Thanks

unit tests

to be super-awesome, Events.js have to be fully unit test covered with test results in all browsers/operating systems

HashChangeFix keeps polling when there is never a hash change.

Looking through HashChangeFix, it seems it defaults to poll every 25 ms. It only stops if it receives a native event for a hash change, which never comes if the hash never changes.

It seems to me that the default should be to check if the browser supports the native hashchange event. Something like: ("onhashchange" in window.document.body)

For example, change:

supportsOnhashchange = (function() {
        var nativeSupport = false;
            return function(support) {
                if (typeof support === 'boolean') {
                    nativeSupport = support;
                }
                return nativeSupport;
            };
         }()),

Into:

supportsOnhashchange = (function() {
        var nativeSupport = "onhashchange" in window.document.body;
            return function(support) {
                if (typeof support === 'boolean') {
                    nativeSupport = support;
                }
                return nativeSupport;
            };
         }()),

Invoking an event throws an error on Chrome

I tried the following code:

Events.bind(window, 'resize', function(e){
    console.log('Hello World');
});
Events.invoke(window, 'resize');

But Chrome threw the following error:

Uncaught [object Object] on events.js:1015

Inspecting line 1015 of events.js showed me that you called a function called despatchEvent instead of dispatchEvent. I think this is a typo? Anyway, fixing this (as well as the same typo on line 60), did prevent the script from throwing an error, but the event still wasn't invoked / executed.

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.