add docs for SVG, and better tests
This commit is contained in:
parent
1aef5dd942
commit
5c9f9d782f
9 changed files with 100 additions and 9 deletions
|
|
@ -65,6 +65,7 @@
|
|||
<h3 id="news-">News:</h3>
|
||||
<ul>
|
||||
<li>added regression tests for reported bugs</li>
|
||||
<li>added support for SVG</li>
|
||||
</ul>
|
||||
<h3 id="bug-fixes-">Bug Fixes:</h3>
|
||||
<ul>
|
||||
|
|
@ -74,6 +75,7 @@
|
|||
<li>fixed caching bug in links w/ config option attached <a href="https://github.com/lhorie/mithril.js/issues/43">#43</a></li>
|
||||
<li>fixed attribute update bug when an element has both <code>oninput</code> and <code>onkeydown</code> handlers <a href="https://github.com/lhorie/mithril.js/issues/36">#36</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<p><a href="/mithril/archive/v0.1.3">v0.1.3</a> - maintenance</p>
|
||||
<h3 id="news-">News:</h3>
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -487,6 +487,7 @@ mock.window = new function() {
|
|||
this[name] = value.toString()
|
||||
},
|
||||
setAttributeNS: function(namespace, name, value) {
|
||||
this.namespaceURI = namespace
|
||||
this[name] = value.toString()
|
||||
},
|
||||
getAttribute: function(name, value) {
|
||||
|
|
@ -495,7 +496,9 @@ mock.window = new function() {
|
|||
}
|
||||
}
|
||||
window.document.createElementNS = function(namespace, tag) {
|
||||
return window.document.createElement(tag)
|
||||
var element = window.document.createElement(tag)
|
||||
element.namespaceURI = namespace
|
||||
return element
|
||||
}
|
||||
window.document.createTextNode = function(text) {
|
||||
return {nodeValue: text.toString()}
|
||||
|
|
@ -665,7 +668,8 @@ function testMithril(mock) {
|
|||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("svg", [m("g")]))
|
||||
return root.childNodes[0].childNodes[0].nodeName === "G"
|
||||
var g = root.childNodes[0].childNodes[0]
|
||||
return g.nodeName === "G" && g.namespaceURI == "http://www.w3.org/2000/svg"
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
|
|
|
|||
|
|
@ -177,6 +177,12 @@ m("a[href='/dashboard']", {config: m.route}, "Dashboard&q
|
|||
<p>Also note that the <code>config</code> callback only runs after a rendering lifecycle is done. Therefore, you should not use <code>config</code> to modify controller and model values, if you expect these changes to render immediately. Changes to controller and model values in this fashion will only render on the next <code>m.render</code> or <code>m.module</code> call.</p>
|
||||
<p>You can use this mechanism to attach custom event listeners to controller methods (for example, when integrating with third party libraries), but you are responsible for making sure the integration with Mithril's autoredrawing system is in place. See the <a href="integration.html">integration guide</a> for more information.</p>
|
||||
<hr>
|
||||
<p>You can use Mithril to create SVG documents (as long as you don't need to support browsers that don't support SVG natively).</p>
|
||||
<p>Mithril automatically figures out the correct XML namespaces when it sees an SVG island in the virtual DOM tree.</p>
|
||||
<pre><code class="lang-javascript">m("svg[height='200px'][width='200px']", [
|
||||
m("image[href='foo.jpg'][height='200px'][width='200px']")
|
||||
])</code></pre>
|
||||
<hr>
|
||||
<h3 id="signature">Signature</h3>
|
||||
<p><a href="how-to-read-signatures.html">How to read signatures</a></p>
|
||||
<pre><code class="lang-clike">VirtualElement m(String selector [, Attributes attributes] [, Children children])
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue