Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom events on document & window #38

Merged
merged 7 commits into from
Nov 23, 2011
Merged

custom events on document & window #38

merged 7 commits into from
Nov 23, 2011

Conversation

rvagg
Copy link
Collaborator

@rvagg rvagg commented Nov 23, 2011

It occurred to me that for IE8 and below, that don't support propertychange on document or window we should just remap the events to documentElement and the world will be at peace.

closes #29
closes #30
closes #32

(does auto-close work if I put those in here? or do they have to be on the actual commit message?)

Is it more tempting to merge when I can close 4 issues at once?

@@ -322,7 +359,6 @@ sink('remove', function (test, ok) {
ok(true, 'remove all events 2');
};
bean.add(el, 'click.foo', handler1);
bean.add(el, 'click.foo', handler1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this because it's unfair to IE8 and below, it'll fail every time because of the way events propagate; plus the plain remove() test preceding this test doesn't do the same thing even though the test is basically the same.

If the intention is to be able to remove additional handlers from within a handler for that same event then that should be a separate test because IE8 and below have some problems in that area that'll need special attention.

@rvagg
Copy link
Collaborator Author

rvagg commented Nov 23, 2011

btw, this does nothing for cross-frame events, the check is for element === document, not element.nodeType === 9, someone who cares about such things may want to have a play with it and write some decent tests.

@ded
Copy link
Collaborator

ded commented Nov 23, 2011

lol. it has to be in the actual commit message, not the pull request. but that's alright. also, it appears @fat has dropped from the planet. i'll go ahead and merge this. looks good

@ded
Copy link
Collaborator

ded commented Nov 23, 2011

woot for one btw

ded added a commit that referenced this pull request Nov 23, 2011
custom events on document & window

closes #29
closes #30
closes #32
@ded ded merged commit 60f342e into fat:master Nov 23, 2011
@fat
Copy link
Owner

fat commented Nov 23, 2011

i didn't drop from the planet - just wan't crazy about the implementation of this proposal :/

@rvagg
Copy link
Collaborator Author

rvagg commented Nov 23, 2011

Then speak up son! what don't you like? I'm happy to modify if I know what the issues are. Is it the fact that we're attaching yet another object to the handler (ref #19)? I've been pondering that one and wondering what your preferred alternative is.

@fat
Copy link
Owner

fat commented Nov 23, 2011

This is fine for now - I think @dperini's solution is the most elegant in nwevents and eventually something I'd prefer to move towards. I am just worried that this sort of thing will pile up over time and I don't think it's a good practice. no big deal though -- sorry for being so busy lately

@rvagg
Copy link
Collaborator Author

rvagg commented Nov 23, 2011

Challenge accepted

@rvagg rvagg mentioned this pull request Nov 25, 2011
@dperini
Copy link

dperini commented Dec 22, 2011

adding, removing and modifying DOM element properties can generate unwanted "Mutation" events and in some browser it could also trigger unwanted reflow/repaint of the page. Avoiding those changes will help with performances.

@rvagg
Copy link
Collaborator Author

rvagg commented Dec 22, 2011

Thanks for joining in @dperini! Changes are nearly ready to land in #39, NW inspired registry rewrite with no DOM or external object modification, the whole __uid thing will soon be gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't fire an event on the window on IE <= 8 Custom events on window.document don't work in IE <= 8
4 participants