Exception in yFiles class framework in Safari 10

Troubleshooting

Summary

With Safari 10 it can happen that a `TypeError: Attempting to change access mechanism for an unconfigurable property.` is thrown when a custom class is declared using the yfiles class framework in non strict mode.

This article was written for an older version. It is only online as a reference for customers using this old version. The information it contains is probably out of date.

The latest information can be found in the yFiles documentation

Description

Safari changed the strict-mode implementation with version 10. Earlier versions of Safari are not affected by this bug.

Declaring a custom class with a constructor function using the yFiles class framework, the class cannot be initialized when the class declaration was executed in non-strict code.

The workaround to this issue is to declare the class in strict mode like this:

yfiles.module("test", function (exports) {
  "use strict";  //enable strict-mode for the code inside the module!
  exports.Test = new yfiles.lang.ClassDefinition(function () {
    return {
      'constructor': function () {
      }
    };
  });
});

All version of yFiles for HTML up to 2.0.1.1 are affected. Newer versions will contain a workaround to this limitation in Safari 10.

The ES6-style class declarations are not affected. Also all yFiles demos are written in strict mode and thus should not be affected. We recommend using strict mode in any case.

Categories this article belongs to:
yFiles for HTML > Other
Applies to:
yFiles for HTML: 2.0
Keywords:
Safari - bug - class - constructor - unconfigurable - known issue