<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Unobtrusive Javascript: Expandable textareas</title>
	<atom:link href="http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/</link>
	<description>Jesu, Juva</description>
	<lastBuildDate>Sat, 21 Jan 2012 20:27:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Scott Moonen</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-379</link>
		<dc:creator><![CDATA[Scott Moonen]]></dc:creator>
		<pubDate>Tue, 20 Oct 2009 17:49:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-379</guid>
		<description><![CDATA[Austin, sorry, I don&#039;t have the time right now to work on improvements and fixes.  I&#039;d be grateful, though, if you post any suggestions that you find.  Thanks!]]></description>
		<content:encoded><![CDATA[<p>Austin, sorry, I don&#8217;t have the time right now to work on improvements and fixes.  I&#8217;d be grateful, though, if you post any suggestions that you find.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Austin</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-378</link>
		<dc:creator><![CDATA[Austin]]></dc:creator>
		<pubDate>Tue, 20 Oct 2009 13:26:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-378</guid>
		<description><![CDATA[Is this something you still work on? Trying to find a workaround for IE]]></description>
		<content:encoded><![CDATA[<p>Is this something you still work on? Trying to find a workaround for IE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Onur Safak</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-116</link>
		<dc:creator><![CDATA[Onur Safak]]></dc:creator>
		<pubDate>Sat, 12 Jul 2008 05:33:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-116</guid>
		<description><![CDATA[Strange, then it&#039;s probably the content type. Same IE version. I&#039;ve tried it on html 4.01, though I was targeting xhtml 1.0 for the production. If that&#039;s the reason, it&#039;s stange to see the doctype changes the IE&#039;s &#039;do not touch my element prototypes!&#039; style =)

Working on this for days now, mostly on compressing / trimming prototype, deciding the code quote style to use, making some helper scripts. Still not sure which quote options to use, anyway.

Right, I&#039;m using the scrollHeight attribute. I was trying to stay away from that approach and use shadow divs instead. But finally scrollHeight appears to be a better option in my case. It works perfect after taking care of IE and FX specific behaviours in my case.

However I don&#039;t think it will be the same in your case, auto grow while you type. I use it during page load to fix block sizes. I keep them readonly, but I saw that when I type anything in a textarea (non readonly) on IE, it&#039;s size gets changed (probably trying to prevent word-wraps). And when it&#039;s readonly, the size is wrongly reported, so I needed to switch readonly mode off during calculation and then back on. This was on xhtml 1.0. You can try it anyway, didn&#039;t try the last version on a test env. it may change on CSS definitons.

My intention was to use it for a wrapped pre for code samples. It works, but I guess I&#039;ll use HTML converted samples and horizontal scrolls now. You can see the code sample below this page :

http://blog.onursafak.com/2008/07/hide-email-links-from-spam-bots-works.html

It&#039;s a textarea, you can see the resize script in blog.js. To keep one more line with this approach, I would get the font size, line spacing and line height during initialization, and add them to the reported size, or just add a row during init, and get the height difference.

Onur

Onur]]></description>
		<content:encoded><![CDATA[<p>Strange, then it&#8217;s probably the content type. Same IE version. I&#8217;ve tried it on html 4.01, though I was targeting xhtml 1.0 for the production. If that&#8217;s the reason, it&#8217;s stange to see the doctype changes the IE&#8217;s &#8216;do not touch my element prototypes!&#8217; style =)</p>
<p>Working on this for days now, mostly on compressing / trimming prototype, deciding the code quote style to use, making some helper scripts. Still not sure which quote options to use, anyway.</p>
<p>Right, I&#8217;m using the scrollHeight attribute. I was trying to stay away from that approach and use shadow divs instead. But finally scrollHeight appears to be a better option in my case. It works perfect after taking care of IE and FX specific behaviours in my case.</p>
<p>However I don&#8217;t think it will be the same in your case, auto grow while you type. I use it during page load to fix block sizes. I keep them readonly, but I saw that when I type anything in a textarea (non readonly) on IE, it&#8217;s size gets changed (probably trying to prevent word-wraps). And when it&#8217;s readonly, the size is wrongly reported, so I needed to switch readonly mode off during calculation and then back on. This was on xhtml 1.0. You can try it anyway, didn&#8217;t try the last version on a test env. it may change on CSS definitons.</p>
<p>My intention was to use it for a wrapped pre for code samples. It works, but I guess I&#8217;ll use HTML converted samples and horizontal scrolls now. You can see the code sample below this page :</p>
<p><a href="http://blog.onursafak.com/2008/07/hide-email-links-from-spam-bots-works.html" rel="nofollow">http://blog.onursafak.com/2008/07/hide-email-links-from-spam-bots-works.html</a></p>
<p>It&#8217;s a textarea, you can see the resize script in blog.js. To keep one more line with this approach, I would get the font size, line spacing and line height during initialization, and add them to the reported size, or just add a row during init, and get the height difference.</p>
<p>Onur</p>
<p>Onur</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Moonen</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-115</link>
		<dc:creator><![CDATA[Scott Moonen]]></dc:creator>
		<pubDate>Thu, 10 Jul 2008 15:15:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-115</guid>
		<description><![CDATA[Aah, yes, I intended to set currentTimer = true just before calling setTimeout.  The intent was to never have more than one outstanding scheduled timer call.  Thanks!]]></description>
		<content:encoded><![CDATA[<p>Aah, yes, I intended to set currentTimer = true just before calling setTimeout.  The intent was to never have more than one outstanding scheduled timer call.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Moonen</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-114</link>
		<dc:creator><![CDATA[Scott Moonen]]></dc:creator>
		<pubDate>Thu, 10 Jul 2008 15:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-114</guid>
		<description><![CDATA[Onur, thanks for writing!

In my testing I used Prototype 1.6.0.2, IE 6.0.2900.2180.xpsp2_gdr.070227-2254.  My Content-Type was set to application/xhtml+xml (at least, assuming that IE6 is advertising this in its Accept header) and my document is valid XHTML.  I didn&#039;t get any JS errors in this case.

How are you measuring the textarea internal content size?  Are you using the scrollHeight attribute on the textarea?  Have you found that to be reliable across browsers?  If so, that seems like a much better approach.

Thanks!]]></description>
		<content:encoded><![CDATA[<p>Onur, thanks for writing!</p>
<p>In my testing I used Prototype 1.6.0.2, IE 6.0.2900.2180.xpsp2_gdr.070227-2254.  My Content-Type was set to application/xhtml+xml (at least, assuming that IE6 is advertising this in its Accept header) and my document is valid XHTML.  I didn&#8217;t get any JS errors in this case.</p>
<p>How are you measuring the textarea internal content size?  Are you using the scrollHeight attribute on the textarea?  Have you found that to be reliable across browsers?  If so, that seems like a much better approach.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Onur Safak</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-113</link>
		<dc:creator><![CDATA[Onur Safak]]></dc:creator>
		<pubDate>Thu, 10 Jul 2008 14:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-113</guid>
		<description><![CDATA[Ah, one last thing,

currentTimer variable seems to have no use in the script (?) :

&lt;code&gt;setTimeout(timerHandler, 250);&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Ah, one last thing,</p>
<p>currentTimer variable seems to have no use in the script (?) :</p>
<p><code>setTimeout(timerHandler, 250);</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Onur Safak</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-112</link>
		<dc:creator><![CDATA[Onur Safak]]></dc:creator>
		<pubDate>Thu, 10 Jul 2008 14:50:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-112</guid>
		<description><![CDATA[Btw, &#039;pre-wrap&#039; problem may be related to document type, didn&#039;t try that.]]></description>
		<content:encoded><![CDATA[<p>Btw, &#8216;pre-wrap&#8217; problem may be related to document type, didn&#8217;t try that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Onur Safak</title>
		<link>http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/#comment-111</link>
		<dc:creator><![CDATA[Onur Safak]]></dc:creator>
		<pubDate>Thu, 10 Jul 2008 14:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.fullvalence.com/?p=29#comment-111</guid>
		<description><![CDATA[Hi Scott

Well, not sure how were you able to test this on IE6, there seems to be some problems with it. Tried with different versions of Prototype.

First I needed to change

&lt;code&gt;var textarea = inputElement;&lt;/code&gt;

into :

&lt;code&gt;var textarea = $(inputElement);&lt;/code&gt;

as IE doesn&#039;t allow us to touch element prototypes, so element variables can&#039;t automatically have &#039;Prototype Library&#039; specific methods. So it gives &#039;variable or method doesn&#039;t exist&#039;

Then I needed to change

&lt;code&gt;var div = $div({id: textarea.id + &#039;_hidden&#039;});&lt;/code&gt;

into :

&lt;code&gt;var div = $div();&lt;/code&gt;

Dunno why, but IE doesn&#039;t like &#039;id&#039; parameter somehow, and the function returns &#039;undefined&#039;

Then one last thing, which made me think this is not always a good solution for IE, I needed to change

&lt;code&gt;&#039;whiteSpace&#039;    : &#039;pre-wrap&#039;&lt;/code&gt;

to :

&lt;code&gt;&#039;whiteSpace&#039;    : &#039;pre&#039;&lt;/code&gt;

as IE doesn&#039;t support &#039;pre-wrap&#039; value, and resets the text style in the &#039;div&#039; to something close to the default style, which makes the script read wrong values. But with no wrapping, this won&#039;t work for every design.

Of course everything could be converted to non-pre style but in my case &quot;pre-wrap&quot; is the reason I&#039;m messing with all this textarea hacks.

So I finally returned to a different approach; measuring the content and resizing the textarea, after giving all my energy to the shadow div technique.

Wanted to note these down, it may be helpful for people with applicable designs. You may want to check common.js on facebook.

Onur]]></description>
		<content:encoded><![CDATA[<p>Hi Scott</p>
<p>Well, not sure how were you able to test this on IE6, there seems to be some problems with it. Tried with different versions of Prototype.</p>
<p>First I needed to change</p>
<p><code>var textarea = inputElement;</code></p>
<p>into :</p>
<p><code>var textarea = $(inputElement);</code></p>
<p>as IE doesn&#8217;t allow us to touch element prototypes, so element variables can&#8217;t automatically have &#8216;Prototype Library&#8217; specific methods. So it gives &#8216;variable or method doesn&#8217;t exist&#8217;</p>
<p>Then I needed to change</p>
<p><code>var div = $div({id: textarea.id + '_hidden'});</code></p>
<p>into :</p>
<p><code>var div = $div();</code></p>
<p>Dunno why, but IE doesn&#8217;t like &#8216;id&#8217; parameter somehow, and the function returns &#8216;undefined&#8217;</p>
<p>Then one last thing, which made me think this is not always a good solution for IE, I needed to change</p>
<p><code>'whiteSpace'    : 'pre-wrap'</code></p>
<p>to :</p>
<p><code>'whiteSpace'    : 'pre'</code></p>
<p>as IE doesn&#8217;t support &#8216;pre-wrap&#8217; value, and resets the text style in the &#8216;div&#8217; to something close to the default style, which makes the script read wrong values. But with no wrapping, this won&#8217;t work for every design.</p>
<p>Of course everything could be converted to non-pre style but in my case &#8220;pre-wrap&#8221; is the reason I&#8217;m messing with all this textarea hacks.</p>
<p>So I finally returned to a different approach; measuring the content and resizing the textarea, after giving all my energy to the shadow div technique.</p>
<p>Wanted to note these down, it may be helpful for people with applicable designs. You may want to check common.js on facebook.</p>
<p>Onur</p>
]]></content:encoded>
	</item>
</channel>
</rss>

