<?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/"
		>
<channel>
	<title>Comments on: Quick Tip: Text Truncation with JavaScript</title>
	<atom:link href="http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: rtyug</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-277947</link>
		<dc:creator>rtyug</dc:creator>
		<pubDate>Tue, 19 Jan 2010 03:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-277947</guid>
		<description>Thank you very much, did not know a useful thing ...</description>
		<content:encoded><![CDATA[<p>Thank you very much, did not know a useful thing &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Fitzgerald</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-4040</link>
		<dc:creator>Patrick Fitzgerald</dc:creator>
		<pubDate>Mon, 27 Feb 2006 17:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-4040</guid>
		<description>Actually rather than using a regexp to weed out html tags I thought it would be better to traverse the dom and count the text in each element until getting to the desired size, then remove any subsequent elements. It sounds like it would be possible, but there might still be a possibility for error. Unfortunately I haven&#039;t had time to continue this.</description>
		<content:encoded><![CDATA[<p>Actually rather than using a regexp to weed out html tags I thought it would be better to traverse the dom and count the text in each element until getting to the desired size, then remove any subsequent elements. It sounds like it would be possible, but there might still be a possibility for error. Unfortunately I haven&#8217;t had time to continue this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slav</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-4002</link>
		<dc:creator>Slav</dc:creator>
		<pubDate>Sat, 25 Feb 2006 07:30:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-4002</guid>
		<description>Re-truncating the text would be helpful along with a regexp to weed out any html tags within the p element so as to not truncate in the wrong spot.</description>
		<content:encoded><![CDATA[<p>Re-truncating the text would be helpful along with a regexp to weed out any html tags within the p element so as to not truncate in the wrong spot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Fitzgerald</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3866</link>
		<dc:creator>Patrick Fitzgerald</dc:creator>
		<pubDate>Wed, 22 Feb 2006 15:53:26 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3866</guid>
		<description>Thanks for the comments - I&#039;m the original author. As mentioned, this was quickly created for a very specific case where the content is plain text without markup; however, I&#039;m thinking of rewriting this to allow for markup (traversing the DOM and adding up character counts as you go along). Adding a link to re-truncate is easy and left as an exercise for the reader. Truncating based on pixel size sounds hard if not impossible/unreliable but I&#039;d love to hear from anyone who has suggestions. Thanks for the tip on text-overflow:ellipsis, but it doesn&#039;t really provide the same functionality.</description>
		<content:encoded><![CDATA[<p>Thanks for the comments &#8211; I&#8217;m the original author. As mentioned, this was quickly created for a very specific case where the content is plain text without markup; however, I&#8217;m thinking of rewriting this to allow for markup (traversing the DOM and adding up character counts as you go along). Adding a link to re-truncate is easy and left as an exercise for the reader. Truncating based on pixel size sounds hard if not impossible/unreliable but I&#8217;d love to hear from anyone who has suggestions. Thanks for the tip on text-overflow:ellipsis, but it doesn&#8217;t really provide the same functionality.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Johnson</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3851</link>
		<dc:creator>Josh Johnson</dc:creator>
		<pubDate>Wed, 22 Feb 2006 04:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3851</guid>
		<description>I was excited about this for a whole 3 seconds.  Then I saw that truncation was being driven by character length, not pixel size, which makes it pretty lame.  The nice part about text-overflow:ellipsis is that the container object doing the truncation can be specified in pixels, so it&#039;s suitable for truncating things like text in a table.</description>
		<content:encoded><![CDATA[<p>I was excited about this for a whole 3 seconds.  Then I saw that truncation was being driven by character length, not pixel size, which makes it pretty lame.  The nice part about text-overflow:ellipsis is that the container object doing the truncation can be specified in pixels, so it&#8217;s suitable for truncating things like text in a table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3834</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 21 Feb 2006 20:29:27 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3834</guid>
		<description>Tom Trenka -  &quot;This can also be dangerous (for the reasons set above) because you may destroy closing tags in the process of truncation.&quot;

He states in the beginning: 
&quot;Assumes that the content is plain text with no markup.&quot;

I think this is only the beginning of a good tip.</description>
		<content:encoded><![CDATA[<p>Tom Trenka &#8211;  &#8220;This can also be dangerous (for the reasons set above) because you may destroy closing tags in the process of truncation.&#8221;</p>
<p>He states in the beginning:<br />
&#8220;Assumes that the content is plain text with no markup.&#8221;</p>
<p>I think this is only the beginning of a good tip.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean FousheÃ©</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3827</link>
		<dc:creator>Sean FousheÃ©</dc:creator>
		<pubDate>Tue, 21 Feb 2006 19:36:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3827</guid>
		<description>Not a bad idea, however I don&#039;t see any use for this in the normal flow of a page&#039;s text.  I would use such a technique to truncate a blog excerpt for use within an AJAX search results call, but I agree this needs more work.  Re-truncating the text would be helpful along with a regexp to weed out any html tags within the p element so as to not truncate in the wrong spot.</description>
		<content:encoded><![CDATA[<p>Not a bad idea, however I don&#8217;t see any use for this in the normal flow of a page&#8217;s text.  I would use such a technique to truncate a blog excerpt for use within an AJAX search results call, but I agree this needs more work.  Re-truncating the text would be helpful along with a regexp to weed out any html tags within the p element so as to not truncate in the wrong spot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Trenka</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3820</link>
		<dc:creator>Tom Trenka</dc:creator>
		<pubDate>Tue, 21 Feb 2006 17:46:11 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3820</guid>
		<description>The one problem with this code is that what you get from innerHTML is *not* the same thing as what you might set it to be.  All you need to do is use innerHTML as a setter in IE with xml-valid markup, and then use it as a get to see what I&#039;m referring to.

This can also be dangerous (for the reasons set above) because you may destroy closing tags in the process of truncation.

Nice thought though.</description>
		<content:encoded><![CDATA[<p>The one problem with this code is that what you get from innerHTML is *not* the same thing as what you might set it to be.  All you need to do is use innerHTML as a setter in IE with xml-valid markup, and then use it as a get to see what I&#8217;m referring to.</p>
<p>This can also be dangerous (for the reasons set above) because you may destroy closing tags in the process of truncation.</p>
<p>Nice thought though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blizzo</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3812</link>
		<dc:creator>Blizzo</dc:creator>
		<pubDate>Tue, 21 Feb 2006 16:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3812</guid>
		<description>Too bad they don&#039;t provide a way to re-truncate after it is expanded.</description>
		<content:encoded><![CDATA[<p>Too bad they don&#8217;t provide a way to re-truncate after it is expanded.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3806</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 21 Feb 2006 14:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3806</guid>
		<description>I believe IE is the only browser that will respect the ellipsis.  In Mozilla you will just get a truncation.</description>
		<content:encoded><![CDATA[<p>I believe IE is the only browser that will respect the ellipsis.  In Mozilla you will just get a truncation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lon</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3794</link>
		<dc:creator>Lon</dc:creator>
		<pubDate>Tue, 21 Feb 2006 14:37:54 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3794</guid>
		<description>This code will fail miserably as soon as your paragraph-content has markup!

What&#039;s wrong with text-overflow:ellipsis?</description>
		<content:encoded><![CDATA[<p>This code will fail miserably as soon as your paragraph-content has markup!</p>
<p>What&#8217;s wrong with text-overflow:ellipsis?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SchizoDuckie</title>
		<link>http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript/comment-page-1#comment-3791</link>
		<dc:creator>SchizoDuckie</dc:creator>
		<pubDate>Tue, 21 Feb 2006 14:11:10 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/quick-tip-text-truncation-with-javascript#comment-3791</guid>
		<description>Nice trick, but usable???

I&#039;ve never felt the urge to click some dots that are appended after a text...</description>
		<content:encoded><![CDATA[<p>Nice trick, but usable???</p>
<p>I&#8217;ve never felt the urge to click some dots that are appended after a text&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

