Skip to content

Commit

Permalink
Fix: title actions produce error in IE11 #3143
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jul 29, 2021
1 parent b938b6d commit 9502ffe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/actions/action.ts
@@ -1,6 +1,6 @@
import { settings } from "../settings";
import { Base } from "../base";
import { property } from "../jsonobject";
import { Helpers } from "survey-core";

/**
* Defines an individual action. Action items can be displayed in certain survey elements - in Toolbar (or action bar), in titles (of pages, panels, questions), in matrix rows (as 'expand details' or 'remove row' buttons), and etc.
Expand Down Expand Up @@ -87,7 +87,12 @@ export interface IAction {
export class Action extends Base implements IAction {
constructor(item: IAction) {
super();
Object.assign(this, item);
//Object.assign(this, item) to support IE11
if (!!item) {
for (var key in item) {
(<any>this)[key] = (<any>item)[key];
}
}
}
location?: string;
@property() id: string;
Expand Down
10 changes: 7 additions & 3 deletions src/utils/responsivity-manager.ts
Expand Up @@ -22,8 +22,10 @@ export class ResponsivityManager {
private itemsSelector: string,
private dotsItemSize: number = 48
) {
this.resizeObserver = new ResizeObserver((_) => this.process());
this.resizeObserver.observe(this.container.parentElement);
if (typeof ResizeObserver !== "undefined") {
this.resizeObserver = new ResizeObserver((_) => this.process());
this.resizeObserver.observe(this.container.parentElement);
}
}

get items(): Array<Action> {
Expand Down Expand Up @@ -120,7 +122,9 @@ export class ResponsivityManager {
}

public dispose(): void {
this.resizeObserver.disconnect();
if (!!this.resizeObserver) {
this.resizeObserver.disconnect();
}
}
}

Expand Down

0 comments on commit 9502ffe

Please sign in to comment.