Skip to content
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
Closed

Can't mount on an SVG object #1872

lord opened this issue Jun 13, 2017 · 3 comments
Labels
Type: Bug For bugs and any other unexpected breakage

Comments

@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
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.

@pygy pygy added the Type: Bug For bugs and any other unexpected breakage label Jun 13, 2017
pygy added a commit to pygy/mithril.js that referenced this issue Jun 14, 2017
@lord
Copy link
Contributor Author

lord commented Jun 14, 2017

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

dead-claudia pushed a commit that referenced this issue Jun 14, 2017
Take the namespace of the root node into account, fix other ns oversight #1872
@dead-claudia
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug For bugs and any other unexpected breakage
Projects
None yet
Development

No branches or pull requests

3 participants