@@ -5,7 +5,7 @@ Elm.Native.Text.make = function(elm) {
5 if (elm.Native.Text.values) return elm.Native.Text.values;
5 if (elm.Native.Text.values) return elm.Native.Text.values;
7 var JS = Elm.JavaScript.make(elm);
7 var JS = Elm.JavaScript.make(elm);
8− var htmlHeight = Elm.Native.Utils.make(elm).htmlHeight;
8+ var Utils = Elm.Native.Utils.make(elm);
9 var Color = Elm.Native.Color.make(elm);
9 var Color = Elm.Native.Color.make(elm);
10 var Element = Elm.Graphics.Element.make(elm);
10 var Element = Elm.Graphics.Element.make(elm);
11 var show = Elm.Native.Show.make(elm).show;
11 var show = Elm.Native.Show.make(elm).show;
@@ -51,15 +51,16 @@ Elm.Native.Text.make = function(elm) {
51 return arr.join('<br/>');
51 return arr.join('<br/>');
54− function toText(str) { return properEscape(JS.fromString(str)); }
54+ function toText(str) { return Utils.txt(properEscape(JS.fromString(str))); }
56+ function addTag(tag) {
56− function addTag(tag) { return function(text) {
57+ return function(text) {
57− return '<' + tag + ' style="padding:0;margin:0">' + text + '</' + tag + '>';
58+ return Utils.txt('<' + tag + '>' + text + '</' + tag + '>');
61 function addStyle(style, value, text) {
62 function addStyle(style, value, text) {
62− return "<span style='" + style + ":" + value + "'>" + text + "</span>";
63+ return Utils.txt("<span style='" + style + ":" + value + "'>" + text + "</span>");
65 function typeface(name, text) {
66 function typeface(name, text) {
@@ -75,8 +76,8 @@ Elm.Native.Text.make = function(elm) {
75 var bold = addTag('b');
76 var bold = addTag('b');
77 function extract(c) {
78 function extract(c) {
78− if (c._3 === 1) { return 'rgb(' + c._0 + ',' + c._1 + ',' + c._2 + ')'; }
79+ if (c._3 === 1) { return 'rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')'; }
79− return 'rgba(' + c._0 + ',' + c._1 + ',' + c._2 + ',' + c._3 + ')';
80+ return 'rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')';
81 function color(c, text) {
82 function color(c, text) {
82 return addStyle('color', extract(c), text);
83 return addStyle('color', extract(c), text);
@@ -87,7 +88,7 @@ Elm.Native.Text.make = function(elm) {
87 return addStyle('text-decoration', 'line-through', text);
88 return addStyle('text-decoration', 'line-through', text);
89 function link(href, text) {
90 function link(href, text) {
90− return "<a href='" + toText(href) + "'>" + text + "</a>";
91+ return Utils.txt("<a href='" + toText(href) + "'>" + text + "</a>");
93 function position(pos) {
94 function position(pos) {
@@ -96,7 +97,7 @@ Elm.Native.Text.make = function(elm) {
96 _0: '<div style="padding:0;margin:0;text-align:' +
97 _0: '<div style="padding:0;margin:0;text-align:' +
97 pos + '">' + text + '</div>'
98 pos + '">' + text + '</div>'
99− var p = A2(htmlHeight, 0, text);
100+ var p = A2(Utils.htmlHeight, 0, text);
100 return A3(Element.newElement, p._0, p._1, e);
101 return A3(Element.newElement, p._0, p._1, e);
@@ -132,5 +133,4 @@ Elm.Native.Text.make = function(elm) {
133 asText : asText
134 asText : asText