智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LightingSystemApp-serial/.svn/pristine/74/7462e69c41d03748899b37c27ad...

28 lines
690 B

3 years ago
"use strict";
const NODE_TYPE = require("../node-type");
const { getRoot, retarget } = require("../helpers/shadow-dom");
class DocumentOrShadowRootImpl {
get activeElement() {
let candidate = this._ownerDocument._lastFocusedElement || this._ownerDocument.body;
if (!candidate) {
return null;
}
candidate = retarget(candidate, this);
if (getRoot(candidate) !== this) {
return null;
}
if (candidate.nodeType !== NODE_TYPE.DOCUMENT_NODE) {
return candidate;
}
if (candidate.body !== null) {
return candidate.body;
}
return candidate.documentElement;
}
}
module.exports = {
implementation: DocumentOrShadowRootImpl
};