mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
chore(types): add null checks (#16351)
This commit is contained in:
@ -160,12 +160,14 @@ export class Router implements ComponentInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private historyDirection() {
|
private historyDirection() {
|
||||||
if (this.win.history.state === null) {
|
const win = this.win;
|
||||||
|
|
||||||
|
if (win.history.state === null) {
|
||||||
this.state++;
|
this.state++;
|
||||||
this.win.history.replaceState(this.state, this.win.document.title, this.win.document.location.href);
|
win.history.replaceState(this.state, win.document.title, win.document.location && win.document.location.href);
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = this.win.history.state;
|
const state = win.history.state;
|
||||||
const lastState = this.lastState;
|
const lastState = this.lastState;
|
||||||
this.lastState = state;
|
this.lastState = state;
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ export class SplitPane implements ComponentInterface {
|
|||||||
this.visible = q.matches;
|
this.visible = q.matches;
|
||||||
};
|
};
|
||||||
const mediaList = this.win.matchMedia(mediaQuery);
|
const mediaList = this.win.matchMedia(mediaQuery);
|
||||||
mediaList.addListener(callback);
|
mediaList.addListener(callback as any);
|
||||||
this.rmL = () => mediaList.removeListener(callback);
|
this.rmL = () => mediaList.removeListener(callback as any);
|
||||||
this.visible = mediaList.matches;
|
this.visible = mediaList.matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ export function doRender(
|
|||||||
|
|
||||||
function createNode(el: HTMLElement, type: CellType): HTMLElement | null {
|
function createNode(el: HTMLElement, type: CellType): HTMLElement | null {
|
||||||
const template = getTemplate(el, type);
|
const template = getTemplate(el, type);
|
||||||
if (template) {
|
if (template && el.ownerDocument) {
|
||||||
return el.ownerDocument.importNode(template.content, true).children[0] as HTMLElement;
|
return el.ownerDocument.importNode(template.content, true).children[0] as HTMLElement;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -15,7 +15,7 @@ export async function attachComponent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const el: any = (typeof component === 'string')
|
const el: any = (typeof component === 'string')
|
||||||
? container.ownerDocument.createElement(component)
|
? container.ownerDocument && container.ownerDocument.createElement(component)
|
||||||
: component;
|
: component;
|
||||||
|
|
||||||
if (cssClasses) {
|
if (cssClasses) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
export function isTextInputFocused(doc: Document): boolean {
|
export function isTextInputFocused(doc: Document): boolean {
|
||||||
const activeElement = doc.activeElement;
|
const activeElement = doc.activeElement;
|
||||||
if (isTextInput(activeElement) && activeElement.parentElement) {
|
if (activeElement && isTextInput(activeElement) && activeElement.parentElement) {
|
||||||
return activeElement.parentElement.querySelector(':focus') === activeElement;
|
return activeElement.parentElement.querySelector(':focus') === activeElement;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user