Skip to content

Conversation

@SlexAxton
Copy link

Special case the Clone method to avoid using the Function constructor so Raphael works in pages with a Content Security Policy that disallows eval.

The input to this function is really only ever a function and and array, but unfortunately typeof or instanceof checks here won't work because the arrays will pass the same checks as the functions. Since the only special operation that's performed on the arrays is a join, I used that to detect whether to use a constructor or to fallback to a function literal.

The rest is just my editor stripping whitespace, which is probably a good thing anyways.

… so Raphael works in pages with a Content Security Policy that disallows eval.
@DmitryBaranovskiy
Copy link
Owner

How come typeof will yield the same result for array as for function? What about plain object {}?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants