Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

[Bug] isPlainObj fn not compatible for IE11 #159

Closed
Methuselah96 opened this issue Oct 17, 2020 · 2 comments · Fixed by #194
Closed

[Bug] isPlainObj fn not compatible for IE11 #159

Methuselah96 opened this issue Oct 17, 2020 · 2 comments · Fixed by #194
Labels
bug Something isn't working from-original-repo
Milestone

Comments

@Methuselah96
Copy link

From @binarykitchen on Thu, 31 Oct 2019 02:53:06 GMT

This implementation is breaking on IE11

  function isPlainObj(value) {
    return (
      value &&
      (typeof value.constructor !== 'function' ||
        value.constructor.name === 'Object')
    );
  }

Always returns false.

Refer to https://stackoverflow.com/questions/25140723/constructor-name-is-undefined-in-internet-explorer

Copied from original issue: immutable-js#1745

@Methuselah96
Copy link
Author

Methuselah96 commented Oct 31, 2020

Related: immutable-js#1648

@bdurrer
Copy link

bdurrer commented Nov 19, 2020

The current function also fails to correctly detect objects which have property 'constructor' that has a property 'name':

// will return false
isPlainObj({ constructor: { name: 'bamboozled' }});

bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
bdurrer added a commit to bdurrer/immutable-js that referenced this issue Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working from-original-repo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants