Giter VIP home page Giter VIP logo

Comments (6)

basham avatar basham commented on June 17, 2024 1

Wow. Had no idea it was depreciated. Every example I've ever found used xlink:href, so I never bothered trying just href. But it works! So, yeah, I'm closing this as a non-issue. Thanks!

from uhtml.

WebReflection avatar WebReflection commented on June 17, 2024 1

For reference sake, it looks like href is very well supported too:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/href#Browser_compatibility

from uhtml.

WebReflection avatar WebReflection commented on June 17, 2024

The 3rd case is expected to not work, because you are using html, so that's not an SVG node, it's just a useless HTML one.

The 5th case seems to be the only one problematic to me, and I'll have a look ASAP, but 3 is a user error, not a library issue.

from uhtml.

basham avatar basham commented on June 17, 2024

I agree. Sorry for not clarifying. I provided Example 3 just to showcase specifically that it doesn't work (as expected). Example 5 doesn't work, and in contrast, I'd expect it to work. Example 5 is really what I'd like for you to explore more.

from uhtml.

basham avatar basham commented on June 17, 2024

I just added a new Example 6 (that doesn't work). It could be a compromise, if you need a stricter separation of HTML and SVG concerns. It essentially does this:

const name = 'check'
const href = `#${name}` // Or `icons.svg#${name}`
const icon = svg`<use xlink:href=${href}></use>`

render(target, html`
  <svg>
    ${icon}
  </svg>
`)

from uhtml.

WebReflection avatar WebReflection commented on June 17, 2024

as xlink:href is deprecated, is there any reason you wouldn't use href instead? it works out of the box.

from uhtml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.