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: Check HTMLDocument constructor exists first for IE10 #5678

Merged
merged 2 commits into from
May 29, 2019
Merged

fix: Check HTMLDocument constructor exists first for IE10 #5678

merged 2 commits into from
May 29, 2019

Conversation

junghwan-park
Copy link
Contributor

AS-IS

  • IE10 is supported browser. But HTMLDocument constructor is not exists in IE10.
  • fabric.js bundle file using HTMLDocument constructor for check document is instance of it.

TO-BE

  • Use Document constructor instead of HTMLDocument constructor if HTMLDocument is not exists in browser global variable.

Resolution

  • Check HTMLDocument exists first.
    • If not, Use Document for check document is instance of it.

ref: #5677

@asturur
Copy link
Member

asturur commented May 9, 2019

@ajvincent can you verify this change does not kill XML document support please? i do not have time for it.

@asturur
Copy link
Member

asturur commented May 9, 2019

@junghwan-park thanks ot be proactive with the fix

@ajvincent
Copy link
Contributor

Apologies for not responding yet: I have been rather busy myself. I have this ticket pinned in my browser to remind me to test it, but on the surface it looks fine.

@ghost
Copy link

ghost commented May 23, 2019

@asturur I have build @junghwan-park branch (https://github.com/junghwan-park/fabric.js/tree/fix-ie10-support) and it looks fine, so I will wait until this is merged.

@ajvincent
Copy link
Contributor

The proposed change does pass the editor.zip test I posted in #5530, but on second look at the patch included, I have a minor concern.

Specifically, the code adds a top-level var DocumentConstructor. Think about namespace pollution, or just being nice to neighboring code in the same scope.

If this block were enclosed in a self-executing function which then defined the necessary properties, I'd be fine with this. That said, be careful how much you enclose in such a function: DOMParser = require('xmldom').DOMParser; is also in the HEADER.js file in the node.js path, and turns up much later.

Consider this a peanut-gallery code review: if @asturur wants to accept the patch as-is, or require a change similar to what I suggest, that is his decision.

HEADER.js Outdated Show resolved Hide resolved
@asturur
Copy link
Member

asturur commented May 27, 2019

Your review is what i was looking for actually. I did not notice/remember the header wasn't wrapped in an anti-leak function wrapping, so that VAR cannot be there at all.
Thanks for spotting this and thanks for verifying that editor.zip works. I really had no time.

@asturur
Copy link
Member

asturur commented May 27, 2019

@junghwan-park sorry for the delay, can you look at the comment/discussion?

thanks for opening this!

@junghwan-park
Copy link
Contributor Author

@asturur I've changed var definition into ternary operation.

@asturur
Copy link
Member

asturur commented May 29, 2019

Guys thanks for collaboration

@asturur asturur merged commit c16085b into fabricjs:master May 29, 2019
@junghwan-park
Copy link
Contributor Author

@asturur @ajvincent Thanks.
I'll looking forward to this feature releasing. :)

@asturur
Copy link
Member

asturur commented May 30, 2019

i ll merge another pr and release 3.0.1

@asturur asturur mentioned this pull request Jun 1, 2019
thiagocunha pushed a commit to thiagocunha/fabric.js that referenced this pull request Nov 18, 2019
)

* fix: Check HTMLDocument constructor exists first for IE10 (fixes: fabricjs#5677)

* fix: Remove 'var' definition & use ternary operation
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.

3 participants