Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype.js compatibility #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

howard
Copy link

@howard howard commented Nov 27, 2015

The method Array.prototype.filter() is overridden by prototype.js, changing the semantics of the call, which triggers an exception and essentially breaks SVGInjector on any site that uses at least version 1.7 of this library.

A test case that breaks without the fix is included.

Since there are no contribution guidelines, I was not sure whether to do take the steps of the release procedure into this pull request. Please advise.

howard added 2 commits July 23, 2015 13:07
In current versions of Magento (Community Edition, at least), Prototype messes
with the Array prototype. As a result, the part of SVGInjector that copies
attributes of the original `img` tag to the newly embedded SVG `tag`.

The fix is manually iterating over the `img` tag's attributes instead of using
`Array.filter()`, and adding the attributes matching the pattern to `imgData`.
@georgms
Copy link

georgms commented Nov 27, 2015

@stryju
Copy link
Contributor

stryju commented Aug 1, 2016

this is more of prototype.js issue

@georgms
Copy link

georgms commented Aug 1, 2016

I agree. But since prototype.js' last release was in September 2015 I doubt they will fix anything. Also, fixing this in prototype.js is not backward compatible. The proposed change here on the other hand is completely transparent.

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.

3 participants