question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

activeElement is missing from Document

See original GitHub issue

Elemental2 version : 1.0.0-RC1 The document object provide by DomGloabl does not have the activeElement property as a workaround i extended the HTMLDocument type and added the property and it worked out

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class MyDocument extends HTMLDocument {
    public Element activeElement;
}

checking this out on MDN it says it is supported by most of modern browsers.

https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/activeElement

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
niloc132commented, Apr 7, 2018

Suggest changing the title and topic of this - @jDramaix, according to MatrixFrog over at https://github.com/google/closure-compiler/pull/2865, elemental2 should perhaps be pulling in more of the *_dom.js files (specifically ie_dom.js), since it appears that activeElement already exists and should not be moved (though it’s type is too specific and must be fixed still).

It being in ie_dom.js doesn’t mean it’s IE only, it just means that most likely it was in IE first so that’s where it got added. We should perhaps move it to w3c_dom1.js or something, but since most projects just use all the default externs it doesn’t actually matter too much which file it’s in.

It isn’t entirely clear to me which direction this should go, but at least other closure-compatible projects seem to prefer adding more extern files.

Alternatives that may be worth considering:

  • Expect that upstream closure-compiler change their extern organization, so that elemental2 need only list the w3c files, nothing browser-specific
  • Don’t worry about missed browser features, require downstream applications to make their own workarounds for all
  • Add all now-standardized properties from *_dom.js etc files to the various .diffs in elemental2

This remains a difficult topic for us non-Googlers to approach, we’re hoping for your guidance here in coordinating between different Google projects (even if non-official).

0reactions
jDramaixcommented, Jun 6, 2019

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

$(document.activeElement) is not working in Firefox [closed]
Please debug your application using console.log(document.activeElement) to see if it's the element you're expecting. This is almost always the first step in ...
Read more >
Document.activeElement - Web APIs | MDN
The activeElement read-only property of the Document interface returns the Element within the DOM that currently has focus.
Read more >
How to Determine Which Element Has Focus in JavaScript
Although an element with focus is always the active element in the document, an active element does not necessarily have focus. For example,...
Read more >
@solid-primitives/active-element - npm
A reactive document.activeElement. Check which element is currently focused.. Latest version: 2.0.3, last published: 3 days ago.
Read more >
builtins.Document.activeElement JavaScript and Node.js code ...
activeElement !== document.body ) { // Not all elements support .blur() - SVGs among them. if( ... `was not found inside element ${new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found