Giter Site home page Giter Site logo

svg on mobile about redom HOT 9 CLOSED

redom avatar redom commented on May 13, 2024
svg on mobile

from redom.

Comments (9)

gblok avatar gblok commented on May 13, 2024 1

fix

var use = s('use');  use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#menu');
var icon = h('i', { className: 'icon ' }, [s('svg', [use])]);

from redom.

pakastin avatar pakastin commented on May 13, 2024 1

I'm pretty sure there's no xlink attribute, so it should be safe to use..

from redom.

pakastin avatar pakastin commented on May 13, 2024 1

You can now use s('use', { xlink: { href: '#menu' } }) (since v3.8.3) πŸ˜‰

from redom.

pakastin avatar pakastin commented on May 13, 2024

There's SVG inside HTML inside SVG, that might be the issue. Desktop somehow renders HTML inside SVG, but mobile doesn't.

from redom.

pakastin avatar pakastin commented on May 13, 2024
body
  svg <-- this shouldn't be here..
    #root
      main
      section
        svg

from redom.

pakastin avatar pakastin commented on May 13, 2024

If you really need HTML inside SVG, you should use <foreignObject>, but better just not..

from redom.

pakastin avatar pakastin commented on May 13, 2024

Oh sorry, my mistake – let's see now..

from redom.

pakastin avatar pakastin commented on May 13, 2024

Could this be the reason:

Safari doesn't support href yet, you need to use xlink:href instead.
href is a new feature of the upcoming SVG 2 specification. xlink:href is the SVG 1.1 version.

https://stackoverflow.com/a/43962207

from redom.

pakastin avatar pakastin commented on May 13, 2024

I was thinking should I add s('use', { xlink: { href: '#menu' } }) as a convenience..

from redom.

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.