<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tudor Barbu&#039;s professional blog &#187; w3c</title>
	<atom:link href="http://blog.motane.lu/tag/w3c/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.motane.lu</link>
	<description>Ramblings about software development</description>
	<lastBuildDate>Thu, 02 Feb 2012 17:38:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Semantics &#8211; input type=&#8221;submit&#8221; vs. button</title>
		<link>http://blog.motane.lu/2009/03/06/semantics-input-typesubmit-vs-button/</link>
		<comments>http://blog.motane.lu/2009/03/06/semantics-input-typesubmit-vs-button/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 21:03:54 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[versus]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=514</guid>
		<description><![CDATA[What&#8217;s the difference between: &#8230;and&#8230; Apparently none. Both snippets look and act exactly the same way. And yet, there is a more subtle difference. The difference lies in the semantics and in the meaning of the two types of buttons. A &#60;button&#62; tag displays a button, that you can click with your mouse and can [...]]]></description>
			<content:encoded><![CDATA[<p>What&#8217;s the difference between:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;/foo&quot; method=&quot;post&quot;&gt;
    &lt;!-- other form fields --&gt;
    &lt;input type=&quot;submit&quot; value=&quot;Send data&quot; /&gt;
&lt;/form&gt;
</pre>
<p>&#8230;and&#8230;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;/foo&quot; method=&quot;post&quot;&gt;
    &lt;!-- other form fields --&gt;
    &lt;button type=&quot;submit&quot;&gt;
        Send data
    &lt;/button&gt;
&lt;/form&gt;
</pre>
<p>Apparently none. Both snippets look and act exactly the same way. And yet, there is a more subtle difference. The difference lies in the semantics and in the meaning of the two types of buttons. A &lt;button&gt; tag displays a button, that you can click with your mouse and can be placed almost anywhere on a page. That&#8217;s all. It doesn&#8217;t have a purpose. </p>
<p>An &lt;input type=&#8221;submit&#8221; &gt; on the other hand does a lot more. It&#8217;s a form element &#8211; can only appear in a form &#8211; and it has meaning attached to it. When you submit a form by clicking on such an button, the value of the button is being sent along with the values of all the other form elements to the server. </p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;/foo&quot; method=&quot;post&quot;&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;item[]&quot; value=&quot;1&quot; id=&quot;item_1&quot; /&gt; &lt;label for=&quot;item_1&quot;&gt;First item&lt;/label&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;item[]&quot; value=&quot;2&quot; id=&quot;item_2&quot; /&gt; &lt;label for=&quot;item_2&quot;&gt;Second item&lt;/label&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;item[]&quot; value=&quot;3&quot; id=&quot;item_3&quot; /&gt; &lt;label for=&quot;item_3&quot;&gt;Third item&lt;/label&gt;
    With selected: &lt;input type=&quot;submit&quot; name=&quot;delete&quot; value=&quot;Delete&quot; /&gt; &lt;input type=&quot;submit&quot; name=&quot;archive&quot; value=&quot;Move to archive&quot; /&gt;
&lt;/form&gt;
</pre>
<p>In this case it matters on which button the user clicks, so an input type=&#8221;submit&#8221; tag is the best choice. But when you have something like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;/foo&quot; method=&quot;post&quot;&gt;
    &lt;input type=&quot;text&quot; name=&quot;email&quot; /&gt;
    &lt;button type=&quot;submit&quot;&gt;
        Subscribe to newsletter
    &lt;/button&gt;
&lt;/form&gt;
</pre>
<p>&#8230;it doesn&#8217;t! So here the button tag is best suited.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2009/03/06/semantics-input-typesubmit-vs-button/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Target blank links</title>
		<link>http://blog.motane.lu/2009/02/09/target-blank-links/</link>
		<comments>http://blog.motane.lu/2009/02/09/target-blank-links/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 21:05:49 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=270</guid>
		<description><![CDATA[One never ending debate on the web is on whether external links should open in new windows. Some say Yes! they should open in new windows because we need to keep the users on our site as long as possible. Usually these are the sales/marketing people. The other group says No! They shouldn&#8217;t open in [...]]]></description>
			<content:encoded><![CDATA[<p>One never ending debate on the web is on whether external links should open in new windows. Some say <q>Yes! they should open in new windows because we need to keep the users on our site as long as possible.</q> Usually these are the sales/marketing people. The other group says <q>No! They shouldn&#8217;t open in new windows, because they&#8217;re extremely annoying and we should always let the user decide</q>. These are the programmers, the group I&#8217;m in. </p>
<p>There&#8217;s also a third player in the debate, the World Wide Web Consortium. According to the XHTML Strict specifications, the usage of the target attribute has been banned. This happens because the XHTML Strict standard focuses entirely on the content of the document while sending all the presentation data to the stylesheet. The target attribute is a presentational one, because it specifies how the data from the hypertext reference should be presented to the user (in a new window, in a frame and so on). The XHTML Strict standard is meant to be used with all kinds of user agents &#8211; not just browsers &#8211; even with those that don&#8217;t support data presentation in the traditional way, in a browser&#8217;s window. This category of user agents includes, but is not limited to, screen readers for visually impaired persons, text-based browser such as links, web crawlers and so on. How could a text-based browser open a link in a new window? It doesn&#8217;t even have the &#8220;new window&#8221; concept.<span id="more-270"></span></p>
<h2><span>Javascript to the rescue</span></h2>
<p>If you want a well formatted XHTML document with <code>target="_blank"</code> links, go for the Transitional doctype. If you&#8217;re stubborn and want to use the Strict doctype, simply mark all external links with a special class, let&#8217;s say &#8220;outgoing&#8221;. If a link has this class than it should open in a new window. A good idea is to use this class in your CSS file and mark all external links with an easy to spot icon, just like Wikipedia does. It&#8217;s very user friendly. After all the links in the document are marked this way, simply use one of the javascript snippets below &#8211; depending on which framework you use &#8211; to make them open in a new window. </p>
<p>First the prototype version&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">
Event.observe(
    window,
    'load',
    function() {
        $$( 'outgoing' ).each(
            function( item ) {
                item.target = '_blank';
            }
        );
    },
    true
);
</pre>
<p>&#8230;and now the jQuery version&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">
$( function() {
        $( '.outgoing' ).each(
            function() {
                this.target = '_blank';
            }
        );
    }
);
</pre>
<p>Isn&#8217;t this just cheating the standard? Well&#8230;ummm&#8230;kind of. But it keeps everybody happy. Because if the target attribute is not supported by the user agent &#8211; not a GUI browser &#8211; it will still receive the well formatted XHTML document and will be able to parse it and use the information within without breaking a sweat. And if the user agent does support the target attribute &#8211; usually this means that it&#8217;s a GUI based web browser &#8211; then all the links will pop up in new, extremely annoying, windows and the folks in the sales department will be very, very happy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2009/02/09/target-blank-links/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

