Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix issue with clone() that causes errors in browsers where a function's... #573

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant

... prototype is an enumerable property (e.g., FF3.6).

pathClone() calls clone() on an object after .toString has been overwritten as R._path2string

clone attempts to recursively clone obj.toString (hereafter 'func') as an object, because Object(func) === func.

It then recursively attempts to clone func.prototype, which makes a call to "new obj.constructor" (aka func itself since func.prototype.constructor === func).

since _path2string contains the code "this.join", it fails when called as a constructor (Objects don't by default have a join property).

You should test this change before merging it - Though I have tested the change fixes my problem, I am not in a place to know all the ramifications of changing the clone function.

Fix issue with clone() that causes errors in browsers where a functio…
…n's prototype is an enumerable property (e.g., FF3.6).


pathClone() calls clone() on an object after .toString has been overwritten as R._path2string

clone attempts to recursively clone obj.toString (hereafter 'func') as an object, because Object(func) === func.

It then recursively attempts to clone func.prototype, which makes a call to "new obj.constructor" (aka func itself since func.prototype.constructor === func).

since _path2string contains the code "this.join", it fails when called as a constructor (Objects don't by default have a join property).

You should test this change before merging it - Though I have tested the change fixes my problem, I am not in a place to know all the ramifications of changing the clone function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment