on master help sign in
Merge remote-tracking branch 'evan/dev' into webgl
commita438d56fb74e2fb4ad5eff0d94d9d0c0cb0080f3 authorJohn P Mayer Jr <john.p.mayer.jr@gmail.com> dateMon 20 Jan 2014, 16:01 (13 years ago) parentd575515df95c68
4 files changed+14−10
libraries/Native/List.js+3−3 libraries/Native/Text.js+7−5 libraries/Native/Utils.js+2−2 runtime/Render/Element.js+2
libraries/Native/List.js+3−3
@@ -55,7 +55,7 @@ Elm.Native.List.make = function(elm) {
5555 function append(xs,ys) {
5656 // append Text
5757 if (xs.text || ys.text) {
58− return Utils.txt(Utils.makeText('',xs) + Utils.makeText('',ys));
58+ return Utils.txt(Utils.makeText(xs) + Utils.makeText(ys));
5959 }
6060
6161 // append Strings
@@ -270,10 +270,10 @@ Elm.Native.List.make = function(elm) {
270270
271271 function join(sep, xss) {
272272 if (sep.text) {
273− sep = Utils.makeText('',sep);
273+ sep = Utils.makeText(sep);
274274 xss = toArray(xss);
275275 for (var i = xss.length; i--; ) {
276− xss[i] = Utils.makeText('',xss[i]);
276+ xss[i] = Utils.makeText(xss[i]);
277277 }
278278 return Utils.txt(xss.join(sep));
279279 }
libraries/Native/Text.js+7−5
@@ -91,10 +91,11 @@ Elm.Native.Text.make = function(elm) {
9191 function position(align) {
9292 function create(text) {
9393 var raw = {
94− ctor:'RawHtml',
95− html: Utils.makeText('text-align:' + align + ';', text),
96− guid: null,
97− args: [],
94+ ctor :'RawHtml',
95+ html : Utils.makeText(text),
96+ align: align,
97+ guid : null,
98+ args : [],
9899 };
99100 var pos = A2(Utils.htmlHeight, 0, raw);
100101 return A3(Element.newElement, pos._0, pos._1, raw);
@@ -106,6 +107,7 @@ Elm.Native.Text.make = function(elm) {
106107 var raw = {
107108 ctor:'RawHtml',
108109 html: text,
110+ align: null,
109111 guid: guid,
110112 args: [],
111113 };
@@ -145,4 +147,4 @@ Elm.Native.Text.make = function(elm) {
145147
146148 asText : asText,
147149 };
148−};
150+};
libraries/Native/Utils.js+2−2
@@ -74,8 +74,8 @@ Elm.Native.Utils.make = function(elm) {
7474 return t;
7575 }
7676
77− function makeText(style, text) {
78− var style = style;
77+ function makeText(text) {
78+ var style = '';
7979 var line = '';
8080 var href = '';
8181 while (true) {
runtime/Render/Element.js+2
@@ -158,10 +158,12 @@ function rawHtml(elem) {
158158 var html = elem.html;
159159 var args = elem.args;
160160 var guid = elem.guid;
161+ var align = elem.align;
161162
162163 var div = newElement('div');
163164 div.innerHTML = html;
164165 div.style.visibility = "hidden";
166+ if (align) div.style.textAlign = align;
165167 document.body.appendChild(div);
166168
167169 for (var i = args.length; i--; ) {