question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

find() convert `xlink:href` to `href`

See original GitHub issue

cheerio@^1.0.0-rc.2 automatically converts xlink:href to href when using find().

cheerio.load('')('<span><svg ><use xlink:href="#1" /></svg></span>').find('use').prop('xlink:href') //undefined
cheerio.load('')('<span><svg ><use xlink:href="#1" /></svg></span>').find('use').prop('href') //#1

Since, Safari doesn’t support href without the “xlink” prefix in svg yet. Maybe, leave xlink:href as it was in cheerio@^0.22.0 is better?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fb55commented, Dec 22, 2020

The serialization part should be fixed with the latest release.

0reactions
ljharbcommented, Dec 22, 2020

Filed #1585 for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

xlink:href - SVG: Scalable Vector Graphics - MDN Web Docs
The xlink:href attribute defines a reference to a resource as a reference IRI. The exact meaning of that link depends on the context...
Read more >
jquery turn a href to xlink:href - svg - Stack Overflow
I tried altering drupal views that generates these links for my site, but the system for security reasons, omits all attributes and links...
Read more >
Get "svg: use: @xlink:href required" when <use> element is ...
I'm running into an issue where Prince 13.1 fails to recognize the "xlink:href" attribute I set on a number of SVG <use />...
Read more >
XML Linking Language (XLink) Version 1.1 - W3C
Abstract. This specification defines the XML Linking Language (XLink) Version 1.1, which allows elements to be inserted into XML documents ...
Read more >
XML, XLink and XPointer - W3Schools
The xlink:href attribute specifies the URL to link to. XLink Example. The following XML document contains XLink features: <?xml version="1.0" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found