on master help sign in
Always switch out Text elements
commitef2b38fe11873cb9df5aaaef2dc0874672e72562 authorEvan Czaplicki <info@elm-lang.org> dateSat 2 Nov 2013, 23:17 (13 years ago) parentdd9c90d
2 files changed+7−2
libraries/Native/Text.js+1−1 runtime/Render/Element.js+6−1
libraries/Native/Text.js+1−1
@@ -96,7 +96,7 @@ Elm.Native.Text.make = function(elm) {
9696 var raw = {
9797 ctor:'RawHtml',
9898 html: '<span style="text-align:' + align + ';">' + text + '</span>',
99− guid: '0',
99+ guid: null,
100100 args: [],
101101 };
102102 var pos = A2(Utils.htmlHeight, 0, raw);
runtime/Render/Element.js+6−1
@@ -205,6 +205,11 @@ function update(node, curr, next) {
205205 switch(nextE.ctor) {
206206 case "Spacer": break;
207207 case "RawHtml":
208+ // only markdown blocks have guids, so this must be a text block
209+ if (nextE.guid === null) {
210+ node.innerHTML = nextE.html;
211+ break;
212+ }
208213 if (nextE.guid !== currE.guid) {
209214 node.parentNode.replaceChild(render(next),node);
210215 return true;
@@ -267,7 +272,7 @@ function update(node, curr, next) {
267272 }
268273 break;
269274 case "Container":
270− update(node.firstChild, currE._1, nextE._1)
275+ update(node.firstChild, currE._1, nextE._1);
271276 setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, node.firstChild);
272277 break;
273278 case "Custom":