<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.2" -->
<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/"
	>

<channel>
	<title>spacer.gif</title>
	<link>http://spacergif.net</link>
	<description>Extend your borders!</description>
	<pubDate>Mon, 23 Apr 2007 07:28:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>Duplicated event object arguments when using Prototype&#8217;s bindAsEventListener</title>
		<link>http://spacergif.net/2006/10/26/duplicated-event-object-arguments/</link>
		<comments>http://spacergif.net/2006/10/26/duplicated-event-object-arguments/#comments</comments>
		<pubDate>Thu, 26 Oct 2006 22:11:08 +0000</pubDate>
		<dc:creator>wiktor</dc:creator>
		
	<category>Javascript</category>
		<guid isPermaLink="false">http://spacergif.net/2006/10/26/duplicated-event-object-arguments-when-using-prototypes-bindaseventlistener/</guid>
		<description><![CDATA[David Flanagan has discovered that an event object is passed to event handlers set with the Microsoft proprietary attachEvent() method. Although this object is not the same as window.event, but it still has the same properties.
At the beginning of this month, I realized this too, when I worked with Prototype&#8217;s bindAsEventListener.
I was writing a function [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.davidflanagan.com/blog/2006_10.html#000114">David Flanagan has discovered</a> that an event object is passed to event handlers set with the Microsoft proprietary attachEvent() method. Although this object is not the same as window.event, but it still has the same properties.</p>
<p>At the beginning of this month, I realized this too, when I worked with Prototype&#8217;s bindAsEventListener.</p>
<p>I was writing a function (called doClick) in an easy ajaxed faq - if you click on the question, you can see the answer - which I bound with the bindAsEventListener to the onclick event.</p>
<pre>doClick: function(event, id) {
var id = id || this.getId(Event.element(event).href);
doAjax("faq", "get_answer", id, this.update.bind(this));
}
a.observe("click", this.doClick.bindAsEventListener(this));</pre>
<p>At the same time I tried to use this function when the DOM has been loaded, because I wanted the given question to load automaticallay, if the hash of the URL contains one of the identifier of the answer (eg. /faq#123). To put it an other way: I wanted doClick not to run only if there is a real click, but also when I want it to run. Something like this:</p>
<pre>if (location.hash) {
this.doClick({}, this.getId(location.hash));
}</pre>
<p>Since rc1 version of Prototype, <a href="http://dev.rubyonrails.org/ticket/5508">the bindAsEventListener accepts additional parameters.</a></p>
<pre>Function.prototype.bindAsEventListener = function(object) {
var __method = this, args = $A(arguments), object = args.shift();
return function(event) {
return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
}
}</pre>
<p>I didn&#8217;t use this feature here, so I supposed when the doClick is triggered by an event it will get only one parameter - the event object of course - as usual.</p>
<p>But when executing the first test, I realized that there were two parameters, namely the event object once again!</p>
<p>I dug into Prototype and I saw that this is not accidentally, the parameters of the closure are appended to the parameter list. At the end of the expression, the concat($A(arguments)) contains the event object once again. I don&#8217;t know why it is there, but I suspect this isn&#8217;t meant to be there. <a href="http://dev.rubyonrails.org/ticket/6497">Prove me wrong. :)</a></p>
<p>And according David&#8217;s post referred to above, this made obvious to me that IE passes the event object - I didn&#8217;t analyse if this is equal to window.event - to the attached function, because the doClick function received two parameters in IE too not just in Firefox which cannot be occur if only window.event exists.</p>
<p>A private sidenote, but at the same time an interesting issue: It is strange to see that members of the scene bump into these questions nearly at the same time. I was looking into this same issue at the beginning of the month, but I simply could not find any details. I thought I was to blame, and I did not want to get into an embarrassing situation by drawing attention to something that I should now. But since this was not the first time that I had realized something in time, but did not care to post about it, I decided to to share these even if I make a mistake. A hundred mistake means a hundred tries. But at least I try! :)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://spacergif.net/2006/10/26/duplicated-event-object-arguments/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Serving documents as application/xhtml+xml without content negotiation</title>
		<link>http://spacergif.net/2006/08/06/serving-documents-as-applicationxhtmlxml-without-content-negotiation/</link>
		<comments>http://spacergif.net/2006/08/06/serving-documents-as-applicationxhtmlxml-without-content-negotiation/#comments</comments>
		<pubDate>Sun, 06 Aug 2006 20:54:16 +0000</pubDate>
		<dc:creator>wiktor</dc:creator>
		
	<category>XHTML</category>
		<guid isPermaLink="false">http://spacergif.net/?p=4</guid>
		<description><![CDATA[This week on Tuesday I read an article entitled Beware of XHTML. After this article I started to play with sending extreme content-types to browsers to see how they react. Of course my goal was what I wrote in the title of this article:
Sending documents as application/xhtml+xml without content negotiation, of course in a standard [...]]]></description>
			<content:encoded><![CDATA[<p>This week on Tuesday I read an article entitled <a title="Beware Of XHTML" href="http://www.eioba.com/a376.html">Beware of XHTML</a>. After this article I started to play with sending extreme content-types to browsers to see how they react. Of course my goal was what I wrote in the title of this article:</p>
<p><em>Sending documents as application/xhtml+xml without content negotiation</em>, of course in a standard way. After several hours of trying and googling I found something ensuring about multiple line headers.</p>
<h3>Quotation from rfc2616 (HTTP/1.1)<br />
2.2 Basic Rules:</h3>
<blockquote><p>&#8220;HTTP/1.1 header field values can be folded onto multiple lines if the continuation line begins with a space or horizontal tab. All linear white space, including folding, has the same semantics as SP. A recipient MAY replace any linear white space with a single SP before interpreting the field value or forwarding the message downstream.&#8221;</p></blockquote>
<p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html">http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html</a></p>
<h3>Here are my test results:</h3>
<table>
<tr>
<th></th>
<th>FF1.5</th>
<th>O9</th>
<th>IE6/7 beta</th>
<th>W3C Validator</th>
</tr>
<tr>
<th>normal</th>
<td>XML</td>
<td>XML</td>
<td>want you to download</td>
<td>XML</td>
</tr>
<tr>
<th>with \r</th>
<td>HTML (why?)</td>
<td>XML</td>
<td>HTML</td>
<td>XML</td>
</tr>
<tr>
<th>with \n</th>
<td>XML</td>
<td>XML</td>
<td>HTML</td>
<td>refuse content-type</td>
</tr>
</table>
<p>So I found that sending content-type as above works like a charm! :)</p>
<p><code>header("Content-Type:\n application/xhtml+xml");</code></p>
<p>As the table shows it seems that the Internet Explorer doesn&#8217;t recognize multiple headers, although it&#8217;s fully standard compatible. Nevertheless in this case it&#8217;s good for us. (I tested under IE5.5 and IE5.0 too and interestingly these want to download it&#8230; Oh my God!)</p>
<p>The only flaw was what W3C Validator said: &#8220;Invalid content-type&#8230;&#8221; I thought that if \r is accepted there are no reasons to refuse \n. (It&#8217;s another story that Firefox thinks the opposite. Who understands this? This should also be reported&#8230;)</p>
<p><a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=3574">I reported it to W3C</a> and three days later they accepted and fixed it in cvs! Great! :)</p>
<p>So <a href="http://spacergif.net/2006/08/06/application-xhtml-xml.php">here is the example page</a>.</p>
<p>I can&#8217;t tell you know how can we use this &#8220;feature&#8221; in practice, can we use at all, but it seems to work&#8230;</p>
<p>Comments are welcome!</p>
<h3>Important links:</h3>
<ul>
<li><a href="http://blog.deconcept.com/2004/11/03/why-its-ok-to-send-xhtml-as-text-html/">Why it&#8217;s OK to send XHTML as text/html</a></li>
<li><a href="http://www.456bereastreet.com/archive/200408/content_negotiation/">Content Negotiation</a></li>
<li><a href="http://www.webstandards.org/learn/articles/askw3c/sep2003/">Serving XHTML with the Right MIME Type588</a></li>
<li><a href="http://keystonewebsites.com/articles/mime_type.php">Serving up XHTML with the correct MIME type</a></li>
<li><a href="http://hixie.ch/advocacy/xhtml">Sending XHTML as text/html Considered Harmful</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRSS>http://spacergif.net/2006/08/06/serving-documents-as-applicationxhtmlxml-without-content-negotiation/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Opera getAttribute(&#8221;action&#8221;) bug</title>
		<link>http://spacergif.net/2006/07/13/opera-getattributeaction-bug/</link>
		<comments>http://spacergif.net/2006/07/13/opera-getattributeaction-bug/#comments</comments>
		<pubDate>Thu, 13 Jul 2006 19:59:51 +0000</pubDate>
		<dc:creator>wiktor</dc:creator>
		
	<category>Javascript</category>
		<guid isPermaLink="false">http://spacergif.net/2006/07/13/opera-getattributeaction-bug/</guid>
		<description><![CDATA[Today I tested our admin framework under Opera 9.0 and realized that I can&#8217;t delete records. We use an image - a big red X - where we use custom attribute, which is actually an action attribute that has &#8220;delete&#8221; value. This is our javascript trigger.
Under Opera this method fails because getAttribute(&#8221;action&#8221;) returns invalid value, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I tested our admin framework under Opera 9.0 and realized that I can&#8217;t delete records. We use an image - a big red X - where we use custom attribute, which is actually an action attribute that has &#8220;delete&#8221; value. This is our <a title="JavaScript triggers" href="http://www.quirksmode.org/blog/archives/2005/02/javascript_trig_1.html">javascript trigger</a>.</p>
<p>Under Opera this method fails because getAttribute(&#8221;action&#8221;) returns invalid value, it returns  &#8220;http://www.foobar.hu/delete&#8221; instead of simply returning &#8220;delete&#8221;&#8230;</p>
<p>It&#8217;s like  		<a href="http://www.glennjones.net/Post/809/getAttributehrefbug.htm">getAttribute href bug</a> 		by <a href="http://www.glennjones.net">Glenn Jones </a></p>
<p>Here is a <a title="Opera getAttribute action bug example" href="http://spacergif.net/2006/07/13/opera_getattribute_action.html">self-explanatory example page</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://spacergif.net/2006/07/13/opera-getattributeaction-bug/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
