-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add chainFilters plugin #733
Conversation
Improve variable usage.
@drschwabe: You can already test this plugin using:
|
@GreLI: The filter bug is indeed a problem in Firefox - maybe this plugin should be enabled by default? |
Improve code. Improve tests.
Improve code. Improve ocmments.
@GreLI: What can I do for further speeding up the review/merge process? |
I haven't made a decision yet. Not sure about the plugin. Need some time to consider. |
@GreLI, @caub:
Arguments for merging this plugin into svgo:
|
@TrySound: Does it make sense to add this plugin to |
@strarsis It is supported. Just require the plugin and pass to plugins array. |
@TrySound: So should this plugin now be merged into svgo repository or rather provided as standalone plugin (e.g. via npm)? |
This looks more like polyfill than optimisation. So yes, this would probably look better as separate package. |
|
||
var walk = require('tree-walk'); | ||
|
||
var domWalker = walk(function(node) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added traverse utility in lib/xast.js.
See |
@TrySound: Thanks for the adjustment. I had not looked at this PR for some while. When I try this test SVG in Chrome and Firefox (both, regular and Developer Edition), the SVG is displayed correctly and equally: |
Hey! Thanks for creating the PR.
Indeed, it looks like the issue has already been resolved. Makes sense given the amount of time that's passed. ^-^' |
This PR adds the chainFilters plugin which chains filter elements using CSS filters as
workaround for some issues with specific browsers, closes #732.
Furthermore a DOM walker is added which can be used for traversing the svgo DOM (by full mode plugins).
Currently some plugins and svgo core all use their own custom "monkeys" implementations for this.
If a filter is already assigned to an element using styles and the plugin also got a filter attribute to the same filter element, this plugin would still create a chain - this may be a feature to add - but this kind of corner case should be very rare, also the element shouldn't have a filter assigned by filter attribute and styles in the first place. Also this plugin currently always assumes relative paths in fragment identifiers.