Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fabric.StaticCanvas): error of changing read-only style field #7462

Merged
merged 2 commits into from
Nov 4, 2021
Merged

fix(fabric.StaticCanvas): error of changing read-only style field #7462

merged 2 commits into from
Nov 4, 2021

Conversation

gamtiq
Copy link
Contributor

@gamtiq gamtiq commented Oct 28, 2021

Calling StaticCanvas.prototype.dispose in IE causes "Assignment to read-only properties is not allowed in strict mode" error.
The fix eliminates this error.

this.lowerCanvasEl.style = this._originalCanvasStyle;
}
catch (err) {
fabric.util.setStyle(this.lowerCanvasEl, this._originalCanvasStyle);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this would work 100% of the time, why not using it as default?
dispose is not a fast operation, even if setStyle is for some reason more complex, is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because setStyle is more slow.
I suppose it should be used as a workaround for IE and similar browsers with restrictions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a slow method, is fine to be always slow. please use setStyle 100% of the time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@asturur asturur merged commit be9a8c7 into fabricjs:master Nov 4, 2021
@asturur
Copy link
Member

asturur commented Nov 4, 2021

Just a clarification that while we are not removing this fix here, probably fabric 5.0 will remove specific workarounds or limitation for ie11. Seems about time.

rockerBOO pushed a commit to rockerBOO/fabric.js that referenced this pull request Nov 27, 2021
@asturur asturur mentioned this pull request Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants