refactor(platform-server): ensure compatibility with noImplicitOverride (#42512)
Adds the `override` keyword to the `platform-server` sources to ensure compatibility with `noImplicitOverride`. PR Close #42512
This commit is contained in:
parent
48c9a0ddc6
commit
8948c93024
|
@ -36,34 +36,34 @@ export function serializeDocument(doc: Document): string {
|
||||||
* DOM Adapter for the server platform based on https://github.com/fgnass/domino.
|
* DOM Adapter for the server platform based on https://github.com/fgnass/domino.
|
||||||
*/
|
*/
|
||||||
export class DominoAdapter extends BrowserDomAdapter {
|
export class DominoAdapter extends BrowserDomAdapter {
|
||||||
static makeCurrent() {
|
static override makeCurrent() {
|
||||||
setDomTypes();
|
setDomTypes();
|
||||||
setRootDomAdapter(new DominoAdapter());
|
setRootDomAdapter(new DominoAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly supportsDOMEvents = false;
|
override readonly supportsDOMEvents = false;
|
||||||
private static defaultDoc: Document;
|
private static defaultDoc: Document;
|
||||||
|
|
||||||
createHtmlDocument(): HTMLDocument {
|
override createHtmlDocument(): HTMLDocument {
|
||||||
return parseDocument('<html><head><title>fakeTitle</title></head><body></body></html>');
|
return parseDocument('<html><head><title>fakeTitle</title></head><body></body></html>');
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultDocument(): Document {
|
override getDefaultDocument(): Document {
|
||||||
if (!DominoAdapter.defaultDoc) {
|
if (!DominoAdapter.defaultDoc) {
|
||||||
DominoAdapter.defaultDoc = domino.createDocument();
|
DominoAdapter.defaultDoc = domino.createDocument();
|
||||||
}
|
}
|
||||||
return DominoAdapter.defaultDoc;
|
return DominoAdapter.defaultDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
isElementNode(node: any): boolean {
|
override isElementNode(node: any): boolean {
|
||||||
return node ? node.nodeType === DominoAdapter.defaultDoc.ELEMENT_NODE : false;
|
return node ? node.nodeType === DominoAdapter.defaultDoc.ELEMENT_NODE : false;
|
||||||
}
|
}
|
||||||
isShadowRoot(node: any): boolean {
|
override isShadowRoot(node: any): boolean {
|
||||||
return node.shadowRoot == node;
|
return node.shadowRoot == node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
||||||
getGlobalEventTarget(doc: Document, target: string): EventTarget|null {
|
override getGlobalEventTarget(doc: Document, target: string): EventTarget|null {
|
||||||
if (target === 'window') {
|
if (target === 'window') {
|
||||||
return doc.defaultView;
|
return doc.defaultView;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,12 @@ export class DominoAdapter extends BrowserDomAdapter {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseHref(doc: Document): string {
|
override getBaseHref(doc: Document): string {
|
||||||
// TODO(alxhub): Need relative path logic from BrowserDomAdapter here?
|
// TODO(alxhub): Need relative path logic from BrowserDomAdapter here?
|
||||||
return doc.documentElement!.querySelector('base')?.getAttribute('href') || '';
|
return doc.documentElement!.querySelector('base')?.getAttribute('href') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchEvent(el: Node, evt: any) {
|
override dispatchEvent(el: Node, evt: any) {
|
||||||
el.dispatchEvent(evt);
|
el.dispatchEvent(evt);
|
||||||
|
|
||||||
// Dispatch the event to the window also.
|
// Dispatch the event to the window also.
|
||||||
|
@ -92,11 +92,11 @@ export class DominoAdapter extends BrowserDomAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserAgent(): string {
|
override getUserAgent(): string {
|
||||||
return 'Fake user agent';
|
return 'Fake user agent';
|
||||||
}
|
}
|
||||||
|
|
||||||
getCookie(name: string): string {
|
override getCookie(name: string): string {
|
||||||
throw new Error('getCookie has not been implemented');
|
throw new Error('getCookie has not been implemented');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ class EmulatedEncapsulationServerRenderer2 extends DefaultServerRenderer2 {
|
||||||
super.setAttribute(element, this.hostAttr, '');
|
super.setAttribute(element, this.hostAttr, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
createElement(parent: any, name: string): Element {
|
override createElement(parent: any, name: string): Element {
|
||||||
const el = super.createElement(parent, name, this.document);
|
const el = super.createElement(parent, name, this.document);
|
||||||
super.setAttribute(el, this.contentAttr, '');
|
super.setAttribute(el, this.contentAttr, '');
|
||||||
return el;
|
return el;
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class ServerStylesHost extends SharedStylesHost {
|
||||||
this._styleNodes.add(el);
|
this._styleNodes.add(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
onStylesAdded(additions: Set<string>) {
|
override onStylesAdded(additions: Set<string>) {
|
||||||
additions.forEach(style => this._addStyle(style));
|
additions.forEach(style => this._addStyle(style));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue