Mithril.js: Rendering a view with m.trust() inside an SVG element throws uncaught exception in Safari

Created on 21 Jun 2016  路  4Comments  路  Source: MithrilJS/mithril.js

Description:

m.trust() uses the parent.insertAdjacentHTML() API, which is not available on SVG elements in Safari.

Steps to Reproduce:

See JSFiddle: http://jsfiddle.net/65pPq/12/

m.render(test, m("svg", {
    width: 100,
  height: 100,
}, [
    m("text", {
    stroke: "black",
    transform: "translate(0,20)"
  }, [
    "Go ",
      m.trust("▸")
  ])
]));

Expected:

A right triangular arrow should render next to the text.

Actual:

A right triangular arrow does not render next to the text, and an error is produced in the JavaScript console. When the render code part of a refresh cycle, the uncaught exception prevents the rerender from completing successfully.

Bug

Most helpful comment

Vote to close: the bug was fixed in Safari in 2012, ie version 6.

https://bugs.webkit.org/show_bug.cgi?id=92903

All 4 comments

If you can figure out a replacement API that works, here's the function.

Vote to close: the bug was fixed in Safari in 2012, ie version 6.

https://bugs.webkit.org/show_bug.cgi?id=92903

@barneycarroll Yeah...Nobody thinks to check the WebKit tracker, it seems... (They don't especially promote it anywhere, though, not nearly to the degree that the other browser implementors do.)

The OP makes it fairly clear this is a known browser defect. I'm just citing the ticket's resolution date as an argument for "won't fix".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

millken picture millken  路  4Comments

tivac picture tivac  路  3Comments

andraaspar picture andraaspar  路  4Comments

omenking picture omenking  路  3Comments

volnei picture volnei  路  3Comments