Delegate events in HelloWorld example app #48

Closed
montlebalm opened this Issue Mar 13, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@montlebalm
Member

montlebalm commented Mar 13, 2013

It looks like the HelloWorld app is trying to do event delegation, but it still needs to do a DOM lookup because of the way it's written.

https://github.com/OpenF2/F2/blob/master/examples/apps/JavaScript/HelloWorld/appclass.js#L12

@brianbaker

This comment has been minimized.

Show comment
Hide comment
@brianbaker

brianbaker Mar 14, 2013

Member

Its just direct binding to the anchor elements, but we should probably promote the usage of delegation in the examples:

$(this.$root).on('click', 'a.testAlert', $.proxy(function() {
    this.ui.Modals.alert("Hello World!", function() {
        F2.log('callback fired!');  
    });
}, this));
Member

brianbaker commented Mar 14, 2013

Its just direct binding to the anchor elements, but we should probably promote the usage of delegation in the examples:

$(this.$root).on('click', 'a.testAlert', $.proxy(function() {
    this.ui.Modals.alert("Hello World!", function() {
        F2.log('callback fired!');  
    });
}, this));
@markhealey

This comment has been minimized.

Show comment
Hide comment
@markhealey

markhealey Mar 14, 2013

Member

@montlebalm Do you want to update this code? Thanks

Member

markhealey commented Mar 14, 2013

@montlebalm Do you want to update this code? Thanks

@markhealey

This comment has been minimized.

Show comment
Hide comment
@markhealey

markhealey Mar 14, 2013

Member

@montlebalm if you make changes, please submit a pull on #49

Member

markhealey commented Mar 14, 2013

@montlebalm if you make changes, please submit a pull on #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment