<?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: Really Simple Live Comment Preview</title>
	<atom:link href="http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 17 Mar 2010 00:38:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Live Kommentarvorschau mit jQuery und WordPress &#8211; bueltge.de [by:ltge.de]</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-78044</link>
		<dc:creator>Live Kommentarvorschau mit jQuery und WordPress &#8211; bueltge.de [by:ltge.de]</dc:creator>
		<pubDate>Wed, 05 Aug 2009 10:39:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-78044</guid>
		<description>[...] Really Simple Live Comment Preview     Artikel #541, 13. November 2007 &#183; Code, Tipps, Webküche, WordPress &#183; 15 Kommentare &#183; Kommentar schreiben  Tags: Javascript, jQuery, Kommentar, Theme, WordPress, WP  gelesen: 5349 &#183; heute: 5 &#183; zuletzt: 5. August 2009  Kommentar-Feed zum Artikel &#183; TrackBack URL [...]</description>
		<content:encoded><![CDATA[<p>[...] Really Simple Live Comment Preview     Artikel #541, 13. November 2007 &middot; Code, Tipps, Webküche, WordPress &middot; 15 Kommentare &middot; Kommentar schreiben  Tags: Javascript, jQuery, Kommentar, Theme, WordPress, WP  gelesen: 5349 &middot; heute: 5 &middot; zuletzt: 5. August 2009  Kommentar-Feed zum Artikel &middot; TrackBack URL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Live Comment Preview, jQuery + Formating &#124; the rabbit hole</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-77928</link>
		<dc:creator>Live Comment Preview, jQuery + Formating &#124; the rabbit hole</dc:creator>
		<pubDate>Wed, 29 Jul 2009 18:39:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-77928</guid>
		<description>[...] I did some searching and I found this post on the subject. The idea and concept on the post was good, however it lacked a few things that I [...]</description>
		<content:encoded><![CDATA[<p>[...] I did some searching and I found this post on the subject. The idea and concept on the post was good, however it lacked a few things that I [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Предпросмотр комментария вживую с помощью jQuery: теория &#187; Свобода слова вебмастерского</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-63675</link>
		<dc:creator>Предпросмотр комментария вживую с помощью jQuery: теория &#187; Свобода слова вебмастерского</dc:creator>
		<pubDate>Sun, 23 Nov 2008 20:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-63675</guid>
		<description>[...] результате дальнейших поисков я очень удачно нашел одну статью, в которой прекрасно расписано то, что и было нужно мне [...]</description>
		<content:encoded><![CDATA[<p>[...] результате дальнейших поисков я очень удачно нашел одну статью, в которой прекрасно расписано то, что и было нужно мне [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vik</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-1877</link>
		<dc:creator>vik</dc:creator>
		<pubDate>Thu, 25 Jan 2007 18:07:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-1877</guid>
		<description>Muy Cool, se ve &lt;strong&gt; bien...&lt;/strong&gt;</description>
		<content:encoded><![CDATA[<p>Muy Cool, se ve <strong> bien&#8230;</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justatest</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-1611</link>
		<dc:creator>justatest</dc:creator>
		<pubDate>Sun, 21 Jan 2007 21:37:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-1611</guid>
		<description>Bold
Kursiv
Link
Code
Em
Paragraf
Gjennomstrek
sterk</description>
		<content:encoded><![CDATA[<p>Bold<br />
Kursiv<br />
Link<br />
Code<br />
Em<br />
Paragraf<br />
Gjennomstrek<br />
sterk</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: test</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-1547</link>
		<dc:creator>test</dc:creator>
		<pubDate>Fri, 19 Jan 2007 12:35:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-1547</guid>
		<description>&lt;b&gt;Bold&lt;/b&gt;
&lt;i&gt;Kursiv&lt;/i&gt;
&lt;a href=&quot;&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt;
&lt;code&gt;Code&lt;/code&gt;
&lt;em&gt;Em&lt;/em&gt;
Paragraf
&lt;strike&gt;Gjennomstrek&lt;/strike&gt;
&lt;strong&gt;sterk&lt;/strong&gt;
&lt;blockquote cite=&quot;&quot;&gt; heisann &lt;/blockquote&gt;
sdsd</description>
		<content:encoded><![CDATA[<p><b>Bold</b><br />
<i>Kursiv</i><br />
<a href="" rel="nofollow">Link</a><br />
<code>Code</code><br />
<em>Em</em><br />
Paragraf<br />
<strike>Gjennomstrek</strike><br />
<strong>sterk</strong></p>
<blockquote cite=""><p> heisann </p></blockquote>
<p>sdsd</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-329</link>
		<dc:creator>Karl</dc:creator>
		<pubDate>Sun, 17 Dec 2006 21:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-329</guid>
		<description>Mooffie,

Wow, thank you so much for your detailed, carefully constructed comment! 
&lt;blockquote&gt;&lt;p&gt;That is, DIVs and TABLEs are illegal inside P.&lt;/p&gt;&lt;/blockquote&gt;
Of course! D&#039;oh! I should have known that&#039;s what was going on there.
&lt;blockquote&gt;&lt;p&gt;BTW, you regexp catches &quot;&lt;script&quot; but it fails to catch &quot;&#x3c;Script&quot;, &quot;&#x3c; script&quot;, &quot;onevent=&#039;...&#039;&quot; and &quot;href=&#039;javascript:...&#039;&quot;.&lt;/p&gt;&lt;/blockquote&gt;
True. It was clearly not a robust solution. And I agree that using WordPress&#039;s (or any other blog platform/CMS&#039;s) parser would be better. I guess that&#039;s one of the reasons I call this &quot;Really Simple.&quot; :)
&lt;blockquote&gt;&lt;p&gt;You should mention, that for almost any event there is a corresponding oneevent(). Why is this so important? So that people know this is not a special case. I hate libraries with unnecessary special cases.&lt;/blockquote&gt;
You are correct here, too. I will update the entry to include that information. It might also be worth noting that the syntax for the &quot;one...&quot; events might be changing when 1.1 is released.
&lt;blockquote&gt;&lt;p&gt;Hmmm... I don&#039;t get it. The first line gets rid of any \n. So the second line doesn&#039;t see them.&lt;/p&gt;&lt;/blockquote&gt;
Ah, you&#039;re right again. If I switch the order, though, I can prevent the appearance of multiple (3 or more) line breaks. that&#039;s what I had intended, and it worked at one point, so I must have switched them around at some point inadvertently. Good catch!
&lt;blockquote&gt;&lt;p&gt;(And you may have to replace any &quot;\n&quot; with &quot;\r?\n&quot;. And there are Macs too...)&lt;/p&gt;&lt;/blockquote&gt;
I can do that. It works fine on my Macs with just the &quot;\n&quot;, but there might be some edge cases that don&#039;t work.
&lt;blockquote&gt;&lt;p&gt;Why is a &quot;\&quot; preceeding the &quot;&lt;&quot; ? Another issue of your highlighter?&lt;/p&gt;&lt;/blockquote&gt;
Nope, must have been a typo. 

Thanks again, Mooffie, for leaving such an excellent reply! I really appreciate the suggestions.</description>
		<content:encoded><![CDATA[<p>Mooffie,</p>
<p>Wow, thank you so much for your detailed, carefully constructed comment! </p>
<blockquote><p>That is, DIVs and TABLEs are illegal inside P.</p>
</blockquote>
<p>Of course! D&#8217;oh! I should have known that&#8217;s what was going on there.</p>
<blockquote><p>BTW, you regexp catches &#8220;&lt;script&#8221; but it fails to catch &#8220;&#x3c;Script&#8221;, &#8220;&#x3c; script&#8221;, &#8220;onevent=&#8217;&#8230;&#8217;&#8221; and &#8220;href=&#8217;javascript:&#8230;&#8217;&#8221;.</p>
</blockquote>
<p>True. It was clearly not a robust solution. And I agree that using WordPress&#8217;s (or any other blog platform/CMS&#8217;s) parser would be better. I guess that&#8217;s one of the reasons I call this &#8220;Really Simple.&#8221; :)</p>
<blockquote><p>You should mention, that for almost any event there is a corresponding oneevent(). Why is this so important? So that people know this is not a special case. I hate libraries with unnecessary special cases.</p>
</blockquote>
<p>You are correct here, too. I will update the entry to include that information. It might also be worth noting that the syntax for the &#8220;one&#8230;&#8221; events might be changing when 1.1 is released.</p>
<blockquote><p>Hmmm&#8230; I don&#8217;t get it. The first line gets rid of any \n. So the second line doesn&#8217;t see them.</p>
</blockquote>
<p>Ah, you&#8217;re right again. If I switch the order, though, I can prevent the appearance of multiple (3 or more) line breaks. that&#8217;s what I had intended, and it worked at one point, so I must have switched them around at some point inadvertently. Good catch!</p>
<blockquote><p>(And you may have to replace any &#8220;\n&#8221; with &#8220;\r?\n&#8221;. And there are Macs too&#8230;)</p>
</blockquote>
<p>I can do that. It works fine on my Macs with just the &#8220;\n&#8221;, but there might be some edge cases that don&#8217;t work.</p>
<blockquote><p>Why is a &#8220;\&#8221; preceeding the &#8220;&lt;&#8221; ? Another issue of your highlighter?</p>
</blockquote>
<p>Nope, must have been a typo. </p>
<p>Thanks again, Mooffie, for leaving such an excellent reply! I really appreciate the suggestions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mooffie</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-319</link>
		<dc:creator>Mooffie</dc:creator>
		<pubDate>Sun, 17 Dec 2006 11:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-319</guid>
		<description>Karl,

Thank you for creating this useful website.

&lt;blockquote&gt;I initially created the preview box immediately after the textarea, still within the paragraph, but Internet Explorer 6 did not like that one bit. The preview text wouldn&#039;t appear [...]
&lt;/blockquote&gt;

Because block-level elements are not allowed inside P.
That is, DIVs and TABLEs are illegal inside P.

&lt;blockquote&gt;[...] but I can&#039;t see how there would be any more of a security issue here than, say, if someone had the Grease Monkey Firefox extension installed.
&lt;/blockquote&gt;

I believe you&#039;re correct. I&#039;m using Opera, which allows me to easily edit-and-reload any page I see.

BTW, you regexp catches &quot;&lt;script&quot; but it fails to catch &quot;&lt;Script&quot;, &quot;&lt;&#160;script&quot;, &quot;on&lt;em&gt;event&lt;/em&gt;=&#039;...&#039;&quot; and &quot;href=&#039;javascript:...&#039;&quot;.

Mary said:
&lt;blockquote&gt;[...] it would be easy to use jQuery to pass the comment preview to a script, which could run KSES (the markup cleaning script WordPress uses) on the comment preview, and then include it in the page source.
&lt;/blockquote&gt;

Marry, this is an excellent idea. But not only beacause of some possible security hole.

This idea, of round-tripping to the server to get the displayed HTML, has an important advantage:

HTML is not the only format for user input. I&#039;m using Drupal, where lots of other &quot;input formats&quot; are possible. Users can use Wiki, AsciiMath, BBCode, Tex, Textile, SmartyPants, CSV, Opus, whatever, and the browser itself &lt;em&gt;doesn&#039;t know&lt;/em&gt; these languages.

In fact, HTML is not even WordPress&#039; input format! WordPress&#039; input format is: &lt;em&gt;filtered HTML&lt;/em&gt;. That is, not all tags are allowed. I could type a TABLE tag here and see it in the preview box, but WordPress would throw it out anyway...

And I believe WordPress also converts URLs into links and smilies into icons. You don&#039;t see this in the preview. In other words, your preview is very &quot;low fidelity&quot;.

So Marry&#039;s idea is good for CMSs like WordPress too.

&lt;blockquote&gt;Fortunately, jQuery has a &quot;onefocus&quot; event handler, which, as the name makes painfully clear, is executed only once
&lt;/blockquote&gt;

You should mention, that for almost &lt;em&gt;any&lt;/em&gt; event there is a corresponding one&lt;em&gt;event&lt;/em&gt;(). Why is this so important? So that people know this is &lt;em&gt;not a special case&lt;/em&gt;. I hate libraries with unnecessary special cases.

&lt;blockquote&gt;We&#039;re going to make everything inside the comment textarea appear inside the &quot;live-preview&quot; DIV as  it is being typed.
[...]
for this type of job. I used keyup
&lt;/blockquote&gt;

My Opera, for some reason, doesn&#039;t trigger this event for &quot;special&quot; keys like BACKSPACE, ENTER and... SPACE. Word has it that BACKSPACE does&#039;t trigger &lt;em&gt;keyup&lt;/em&gt; on IE either (sorry I can&#039;t verify this claim).

This problem doesn&#039;t seem to occur for the &lt;em&gt;keydown&lt;/em&gt; and &lt;em&gt;keypress&lt;/em&gt; events. Are these two events triggered before or after the textarea&#039;s content is modified? If before, Mary&#039;s &lt;em&gt;timeout&lt;/em&gt; idea would solve the problem. 

&lt;blockquote&gt;$comment = $comment.replace(/\n/g, &quot;&lt;br /&gt;&quot;);
$comment = $comment.replace(/\n\n+/g, &#039;&lt;br /&gt;&lt;br /&gt;&#039;);
&lt;/blockquote&gt;

Hmmm... I don&#039;t get it. The first line gets rid of any \n. So the second line doesn&#039;t see them.

(And you may have to replace any &quot;\n&quot; with &quot;\r?\n&quot;. And there are Macs too...)

&lt;blockquote&gt;replace(/(\&lt;\/?)script/g,
&lt;/blockquote&gt;

Why is a &quot;\&quot; preceeding the &quot;&lt;&quot; ? Another issue of your highligher?
BTW, if you use &quot;\x3C&quot; instead of &quot;&lt;&quot; users won&#039;t have to change anything after they paste your code.</description>
		<content:encoded><![CDATA[<p>Karl,</p>
<p>Thank you for creating this useful website.</p>
<blockquote><p>I initially created the preview box immediately after the textarea, still within the paragraph, but Internet Explorer 6 did not like that one bit. The preview text wouldn&#8217;t appear [...]
</p></blockquote>
<p>Because block-level elements are not allowed inside P.<br />
That is, DIVs and TABLEs are illegal inside P.</p>
<blockquote><p>[...] but I can&#8217;t see how there would be any more of a security issue here than, say, if someone had the Grease Monkey Firefox extension installed.
</p></blockquote>
<p>I believe you&#8217;re correct. I&#8217;m using Opera, which allows me to easily edit-and-reload any page I see.</p>
<p>BTW, you regexp catches &#8220;&lt;script&#8221; but it fails to catch &#8220;&lt;Script&#8221;, &#8220;&lt;&nbsp;script&#8221;, &#8220;on<em>event</em>=&#8217;&#8230;&#8217;&#8221; and &#8220;href=&#8217;javascript:&#8230;&#8217;&#8221;.</p>
<p>Mary said:</p>
<blockquote><p>[...] it would be easy to use jQuery to pass the comment preview to a script, which could run KSES (the markup cleaning script WordPress uses) on the comment preview, and then include it in the page source.
</p></blockquote>
<p>Marry, this is an excellent idea. But not only beacause of some possible security hole.</p>
<p>This idea, of round-tripping to the server to get the displayed HTML, has an important advantage:</p>
<p>HTML is not the only format for user input. I&#8217;m using Drupal, where lots of other &#8220;input formats&#8221; are possible. Users can use Wiki, AsciiMath, BBCode, Tex, Textile, SmartyPants, CSV, Opus, whatever, and the browser itself <em>doesn&#8217;t know</em> these languages.</p>
<p>In fact, HTML is not even WordPress&#8217; input format! WordPress&#8217; input format is: <em>filtered HTML</em>. That is, not all tags are allowed. I could type a TABLE tag here and see it in the preview box, but WordPress would throw it out anyway&#8230;</p>
<p>And I believe WordPress also converts URLs into links and smilies into icons. You don&#8217;t see this in the preview. In other words, your preview is very &#8220;low fidelity&#8221;.</p>
<p>So Marry&#8217;s idea is good for CMSs like WordPress too.</p>
<blockquote><p>Fortunately, jQuery has a &#8220;onefocus&#8221; event handler, which, as the name makes painfully clear, is executed only once
</p></blockquote>
<p>You should mention, that for almost <em>any</em> event there is a corresponding one<em>event</em>(). Why is this so important? So that people know this is <em>not a special case</em>. I hate libraries with unnecessary special cases.</p>
<blockquote><p>We&#8217;re going to make everything inside the comment textarea appear inside the &#8220;live-preview&#8221; DIV as  it is being typed.<br />
[...]<br />
for this type of job. I used keyup
</p></blockquote>
<p>My Opera, for some reason, doesn&#8217;t trigger this event for &#8220;special&#8221; keys like BACKSPACE, ENTER and&#8230; SPACE. Word has it that BACKSPACE does&#8217;t trigger <em>keyup</em> on IE either (sorry I can&#8217;t verify this claim).</p>
<p>This problem doesn&#8217;t seem to occur for the <em>keydown</em> and <em>keypress</em> events. Are these two events triggered before or after the textarea&#8217;s content is modified? If before, Mary&#8217;s <em>timeout</em> idea would solve the problem. </p>
<blockquote><p>$comment = $comment.replace(/\n/g, &#8220;&lt;br /&gt;&#8221;);<br />
$comment = $comment.replace(/\n\n+/g, &#8216;&lt;br /&gt;&lt;br /&gt;&#8217;);
</p></blockquote>
<p>Hmmm&#8230; I don&#8217;t get it. The first line gets rid of any \n. So the second line doesn&#8217;t see them.</p>
<p>(And you may have to replace any &#8220;\n&#8221; with &#8220;\r?\n&#8221;. And there are Macs too&#8230;)</p>
<blockquote><p>replace(/(\&amp;lt;\/?)script/g,
</p></blockquote>
<p>Why is a &#8220;\&#8221; preceeding the &#8220;&amp;lt;&#8221; ? Another issue of your highligher?<br />
BTW, if you use &#8220;\x3C&#8221; instead of &#8220;&amp;lt;&#8221; users won&#8217;t have to change anything after they paste your code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-224</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Wed, 13 Dec 2006 16:44:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-224</guid>
		<description>Wanted to see my live preview... very interesting... jQuery makes a lot of things possible, even for non-Javascript programmers like myself!

Rick</description>
		<content:encoded><![CDATA[<p>Wanted to see my live preview&#8230; very interesting&#8230; jQuery makes a lot of things possible, even for non-Javascript programmers like myself!</p>
<p>Rick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jammodotnet</title>
		<link>http://www.learningjquery.com/2006/11/really-simple-live-comment-preview/comment-page-1#comment-185</link>
		<dc:creator>jammodotnet</dc:creator>
		<pubDate>Fri, 08 Dec 2006 17:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/11/really-simple-live-comment-preview#comment-185</guid>
		<description>this is really neat.
i run expression engine for a few of my sites.

id like to try to implement this technique to display a live comment preview, complete with the commenter&#039;s information that would be inserted INTO the post itself (ie: name, time/date stamp, etc).

i love jQuery more and more.
:)</description>
		<content:encoded><![CDATA[<p>this is really neat.<br />
i run expression engine for a few of my sites.</p>
<p>id like to try to implement this technique to display a live comment preview, complete with the commenter&#8217;s information that would be inserted INTO the post itself (ie: name, time/date stamp, etc).</p>
<p>i love jQuery more and more.<br />
:)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
