Skip to content

Remove xmlns:xlink in removeXMLNS plugin#1508

Merged
TrySound merged 1 commit intosvg:masterfrom
devongovett:patch-1
Oct 15, 2021
Merged

Remove xmlns:xlink in removeXMLNS plugin#1508
TrySound merged 1 commit intosvg:masterfrom
devongovett:patch-1

Conversation

@devongovett
Copy link
Copy Markdown
Contributor

xmlns:xlink is also not required in SVGs embedded in HTML

xmlns:xlink is also not required in SVGs embedded in HTML
@TrySound
Copy link
Copy Markdown
Member

TrySound commented Aug 2, 2021

Hi @devongovett. Thanks for PR. I think removeUnusedNS.js removes xmlns:xlink.

@devongovett
Copy link
Copy Markdown
Contributor Author

That only removes it if it's unused though. In this case, it's always safe to remove xlink:href in HTML. Since this plugin is opt-in, I think it makes sense to do it here as well.

@TrySound
Copy link
Copy Markdown
Member

TrySound commented Aug 14, 2021

I think it's better to create a separate plugin which removes xlink namespace from xlink:herf as well.
Otherwise some images may be broken.
I can take care of it in a few days.

TrySound added a commit that referenced this pull request Aug 22, 2021
Ref #1508

The new plugin removes xmlns:xlink from <svg> and replaces xlink:href
with href attribute.

xlink namespace is obsolete in SVG 2. Href attribute is recommended
replacement to xlink:href.

This plugin will be enabled by default in SVGO 3.

See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/href
@TrySound TrySound merged commit 2d6deea into svg:master Oct 15, 2021
@TrySound
Copy link
Copy Markdown
Member

I think it should be safe enough. We can always revert if somebody come with issues.

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