Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Support listening to events triggered directly on the window #61

Closed
wants to merge 2 commits into from

Conversation

lazd
Copy link
Contributor

@lazd lazd commented Nov 6, 2014

Changes

  • matchesRoot has been modified to check if the element is equal to the window
  • matchesRoot has been modified to check if the element is equal to document.documentElement
    • This is a more cross-browser compatible way of implementing the check added by @matthew-andrews in 4f0eaa7. I've left the previous commit intact for history's sake.
  • assert/refute are explicitly declared now
    • Existing tests were not passing due to both functions being undefined.
    • This is related to Tests do not pass with fresh master #59, but does not fix it entirely as tests still will not pass in PhantomJS

Testing

The following tests were added:

  • Delegate instances on window catch events when bubbled from the body
  • Delegate instances on window catch events when bubbled from the document
  • Delegate instances on window catch events when bubbled from the element
  • Delegate instances on window cause events when dispatched directly on window

Tests were ran against the following browsers and are passing

  • Safari 7.0.6, OS X 10.9.5
  • Chrome 38.0.2125.111, OS X 10.9.5
  • Firefox 33.0, OS X 10.9.5
  • IE 9.0, Windows 7 Enterprise x64

setupHelper.fireMouseEvent(document, 'click');

// assert.calledOnce(spy); // "Invalid Argument" in IE 9
assert(spy.callCount === 1); // Workaround for Buster.js IE 9 error
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was VERY curious. I was getting "Invalid Argument" error in IE 9 when using the assert.calledOnce(spy) statement, but the error went away and the test passed when I used assert(spy.callCount === 1).

Looks like Buster needs better cross-browser testing ;)

@notlee
Copy link
Contributor

notlee commented Sep 18, 2019

This looks good to me @lazd! 5 years later... thanks for the contribution! I've created a PR here with your changes to resolve some conflicts. #102

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

Successfully merging this pull request may close these issues.

4 participants