Skip to content

Conversation

acusti
Copy link
Contributor

@acusti acusti commented Oct 4, 2016

Fixes #1619

@acusti
Copy link
Contributor Author

acusti commented Oct 4, 2016

The actual implementation of hasFocus() is not dependent on whether there’s an activeElement or not, but rather on whether the actual browsing context (or a focusable area inside it, including a nested browsing context) is focused by the user. From MDN:

For example, an active element within a popup window that is not the foreground does not have focus.

Or, if you open developer tools and click somewhere inside it, the current document and any nested browsing contexts will no longer have focus.

See the “has focus steps” in the spec

I thought that in the context of jsdom, checking for an activeElement might be enough, considering that it is a headless browser. But if that isn’t the case, I’d be happy to remove hasFocus(). It will only mean that I will need to extract the other tests from html/editing/focus/document-level-focus-apis/document-level-apis.html and create a new test file to just check those. In that case, should I make the new test file as test/living-dom/document-level-apis.js?

@domenic
Copy link
Member

domenic commented Oct 15, 2016

Sorry for the delay in responding. This is great as-is, however :). Merging and doing a release now!

@domenic domenic merged commit e060182 into jsdom:master Oct 15, 2016
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.

2 participants