Object.defineProperty in ES5?

前端 未结 3 2020
青春惊慌失措
青春惊慌失措 2020-11-28 14:54

I\'m seeing posts about a \'new\' Object.create that makes enumeration configurable. However, it relies on a Object.defineProperty method. I can\'t find a cross browser im

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 15:14

    For what it's worth,

    Object.defineProperty works in ie8 and FF4.

    This means its worthwhile to feature sniff and implement it where it is useful seeing as you would hope the upgrade from ie 6/7 to 8/9 will occur in the next few years.

    Another thing to be wary of is that the dontEnum property has a bug in JScript

    You will have to work around the way you use the dontEnum property in IE.

    [Edit]:

    Here's documentation for Internet explorer and a link to the ES5 specification (Page 122 , 15.2.3.6)

提交回复
热议问题