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

Can't mount on an SVG object #1872

Closed
lord opened this Issue Jun 13, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@lord
Copy link
Contributor

lord commented Jun 13, 2017

This code doesn't display anything:

  <svg xmlns="http://www.w3.org/2000/svg" id="editor" class="editor" height="100%">
  </svg>
  <script>
    m.mount(document.getElementById('editor'), {view: function() {
      return m('text', {x: 16, y: 16}, 'text test!')
    }})
  </script>

but this code does:

  <div id="editor" class="editor" height="100%">
  </div>
  <script>
    m.mount(document.getElementById('editor'), {view: function() {
      return m('svg', [m('text', {x: 16, y: 16}, 'text test!')])
    }})
  </script>

In both cases the <text> appears in the Chrome inspector, so I'm guessing it may be a namespacing issue again, like with #1820?

Also — absolutely loving Mithril, thanks for the beautiful library!

@pygy

This comment has been minimized.

Copy link
Member

pygy commented Jun 13, 2017

Good catch, and good diagnosis, m.render (which is used under the hood by mount) ignores the namespace of the root node.

@lord

This comment has been minimized.

Copy link
Contributor

lord commented Jun 14, 2017

Haha, wow, that was a fast fix. Thanks!

isiahmeadows pushed a commit that referenced this issue Jun 14, 2017

Isiah Meadows
Merge pull request #1873 from pygy/fix-1872
Take the namespace of the root node into account, fix other ns oversight #1872
@isiahmeadows

This comment has been minimized.

Copy link
Collaborator

isiahmeadows commented Jun 14, 2017

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment