简体   繁体   中英

iOS 6 javascript intermittent issues with object.defineProperty

Has anyone else noticed intermittent errors/issues in the new iOS 6 javascript engine when accessing properties on objects where the property was defined using newer Object.defineProperty syntax?

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty

I'm seeing occasions where the javascript will fail stating undefined is not a function on methods of objects accessied as properties on objects defined in this manner.

According to Kangax's ES5 table , "In some versions of WebKit Object.defineProperty does not work with DOM objects." I'm assuming this is what you may be referring to. It's note #2 at the bottom of the page. Hope this helps!

In case you haven't already solved this, make sure the said property is enumerable (and if necessary configurable)...

Object.defineProperty(obj, "key", {
  enumerable: true,
  configurable: true
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM