<?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>Michael Baierl &#187; javascript</title>
	<atom:link href="http://blog.mbaierl.com/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mbaierl.com</link>
	<description>Blog von Michael Baierl</description>
	<lastBuildDate>Wed, 25 Jan 2012 09:17:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dojo 1.6 and open bugs</title>
		<link>http://blog.mbaierl.com/2011/04/dojo-1-6-and-open-bugs.html</link>
		<comments>http://blog.mbaierl.com/2011/04/dojo-1-6-and-open-bugs.html#comments</comments>
		<pubDate>Thu, 21 Apr 2011 14:16:15 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://blog.mbaierl.com/?p=1109</guid>
		<description><![CDATA[Wow, I can hardly believe it&#8230; In Dojo 1.6.0 my very old bug has finally been fixed&#8230;. it supports scheme less URLs, after almost 2 years, wow! Bug closed.]]></description>
			<content:encoded><![CDATA[<p>Wow, I can hardly believe it&#8230; In Dojo 1.6.0 <a href="http://blog.mbaierl.com/2010/08/dojo-1-5-and-open-bugs.html">my very old bug</a> has finally been fixed&#8230;. it <a href="http://blog.mbaierl.com/2010/03/scheme-less-urls-in-xdomain-dojo.html">supports scheme less URLs</a>, after almost 2 years, wow!</p>
<p><a href="http://bugs.dojotoolkit.org/ticket/8546">Bug closed</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2011/04/dojo-1-6-and-open-bugs.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dojo 1.5 and open bugs&#8230;</title>
		<link>http://blog.mbaierl.com/2010/08/dojo-1-5-and-open-bugs.html</link>
		<comments>http://blog.mbaierl.com/2010/08/dojo-1-5-and-open-bugs.html#comments</comments>
		<pubDate>Thu, 19 Aug 2010 07:51:11 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.mbaierl.com/?p=672</guid>
		<description><![CDATA[And the saga continues&#8230; I reported a Dojo bug about scheme-less URLs in March (filed against 1.4.2)&#8230; now the brand new 1.5 has been released and the (simple-to-fix bug)&#8230; was not fixed. Why? Well, I don&#8217;t know. Maybe because they don&#8217;t care? The comment in bug 8546 is: It&#8217;s been open for 18 months, and [...]]]></description>
			<content:encoded><![CDATA[<p>And the saga continues&#8230; I reported a <a href="http://blog.mbaierl.com/2010/03/scheme-less-urls-in-xdomain-dojo.html">Dojo bug about scheme-less URLs</a> in March (filed against 1.4.2)&#8230; now the brand new 1.5 has been released and the (simple-to-fix bug)&#8230; <strong>was not fixed</strong>.</p>
<p>Why? Well, I don&#8217;t know. Maybe because they don&#8217;t care? The comment in <a href="http://bugs.dojotoolkit.org/ticket/8546">bug 8546</a> is:</p>
<blockquote><p>It&#8217;s been open for 18 months, and it was pointed out to me as a bug by a large user of Dojo and jQuery. They reported the issue to jQuery, and it was fixed in 2 weeks, and we&#8217;re going on 18 months.</p></blockquote>
<p>Sorry dojo, speed-wise you already lost, no matter what you do!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2010/08/dojo-1-5-and-open-bugs.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scheme-less URLs in xDomain Dojo</title>
		<link>http://blog.mbaierl.com/2010/03/scheme-less-urls-in-xdomain-dojo.html</link>
		<comments>http://blog.mbaierl.com/2010/03/scheme-less-urls-in-xdomain-dojo.html#comments</comments>
		<pubDate>Mon, 22 Mar 2010 19:49:11 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.mbaierl.com/?p=552</guid>
		<description><![CDATA[Sometimes I have the feeling that the only large Web site that uses scheme-less URLs is the one I work with during office hours&#8230; because not a lot of Web sites use this handy feature which allows to include resources independent of the protocol (i.e. &#60;link type=&#8221;text/css&#8221; rel=&#8221;stylesheet&#8221; media=&#8221;all&#8221; href=&#8221;//www.domain.com/styles/main.css&#8221; /&#62; &#8211; note the missing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.mbaierl.com/files/2010/03/dojo_bug_8546.png"><img class="alignright size-thumbnail wp-image-553" title="dojo_bug_8546" src="http://blog.mbaierl.com/files/2010/03/dojo_bug_8546-150x150.png" alt="" width="150" height="150" /></a>Sometimes I have the feeling that the only large Web site that uses scheme-less URLs is the one I work with during office hours&#8230; because not a lot of Web sites use this handy feature which allows to include resources independent of the protocol (i.e. <em>&lt;link type=&#8221;text/css&#8221; rel=&#8221;stylesheet&#8221; media=&#8221;all&#8221; href=&#8221;//www.domain.com/styles/main.css&#8221; /&gt;</em> &#8211; note the missing protocol). This works cross browser and is perfectly valid &#8211; and saves the hassle of security warnings in IE in case of secure Web sites.</p>
<p>Anyhow, when I used the <a href="http://jquery.com/">jQuery</a> library it turned out that these scheme-less URLs confused the <a href="http://api.jquery.com/jQuery.getScript/">.getScript</a> function. The bug was easy to find and <a href="http://dev.jquery.com/ticket/1750">report</a> and after some whining it got fixed. I mean, how hard is it? Fix the simple bug, add a test case to the unit tests (<a href="http://blog.mbaierl.com/2009/03/unit-tests-are-way-cool.html">you do unit test, don&#8217;t you?</a>), run the tests done.</p>
<p>Does not seem to be the case with <a href="http://www.dojotoolkit.org/">Dojo</a>, which experiences the same bug (already reported <a href="http://bugs.dojotoolkit.org/ticket/8546">here</a> and <a href="http://bugs.dojotoolkit.org/ticket/10696">here</a>). Not only that the bug is open since 14 month, this simple bug was reported in version 1.2.3 and won&#8217;t be fixed until version 2.0? Come on, you must be kidding! Signing up and submitting a comment or patch (1/2 line of code: <em>|| relpath.indexOf(&#8216;//&#8217;) === 0</em> appended to the first <em>if</em> in the function <em>_xdIsXDomainPath</em>) is also not possible because the user sign-up leads to a 404 page. Uuups.</p>
<p>So I&#8217;ll end up with maintaining my local patch file, and hopefully I remember to apply the patch in case there is a future Dojo upgrade&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2010/03/scheme-less-urls-in-xdomain-dojo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE and script loading via Ajax</title>
		<link>http://blog.mbaierl.com/2009/11/ie-and-script-loading-via-ajax.html</link>
		<comments>http://blog.mbaierl.com/2009/11/ie-and-script-loading-via-ajax.html#comments</comments>
		<pubDate>Thu, 12 Nov 2009 16:24:00 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://test.mbaierl.com/2009/11/ie-and-script-loading-via-ajax.html</guid>
		<description><![CDATA[Today I stumbled across a very strange IE issue. Again. Basically the code that was working fine in all real browsers &#8211; the code loaded some HTML fragment containing script tags using AJAX and added it to the page. Nothing complicated, except that those script tags require some special handling in Internet Explorer, as they [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0pt 10px 10px 0pt;float: left;width: 231px;height: 101px" src="http://mbaierl.com/blog/uploaded_images/274724789_6697a764ee_o-753815.jpg" alt="" border="0" />Today I stumbled across a very strange IE issue. <a href="http://mbaierl.com/blog/2009/09/void0-javascriptvoid0.html">Again</a>. Basically the code that was working fine in all <a href="http://www.stopie6.com/">real browsers</a> &#8211; the code loaded some HTML fragment containing script tags using AJAX and added it to the page. Nothing complicated, except that those script tags require some special handling in Internet Explorer, as they do not execute automatically when being added to the page:<br />
<blockquote>if(IE) {<br />  var scripttags = <span style="font-style: italic">NewlyAddedDomViaAjax</span>.getElementsByTagName(&#8220;SCRIPT&#8221;);<br />  var head = document.getElementsByTagName(&#8220;head&#8221;)[0];<br />  for(var i=0, j=scripttags.length; i &lt; j; i++)<br />  {<br />    var scripttag = <span class="objectBox objectBox-string ">document.createElement(&#8220;SCRIPT&#8221;);<br />    scripttag.src = scripttags[i].src;        <br />    head.appendChild(scripttag); </span><br />  }<br />}</p></blockquote>
<p>No big magic and works fine. Except for the case that the script tag comes as <span style="font-weight: bold">first element</span> in the newly inserted HTML code. In this case the getElementsByTagName is *not* returning the script node at all &#8211; it just returns an empty result set. This means that the JavaScript code is not executed in IE&#8230;.</p>
<p>Luckily this problem is quite easy to solve &#8211; just move some other HTML code in front of the HTML snippet that is returned via AJAX &#8211; place all the script tags at its end and everything will work fine!</p>
<p>btw, how about Google? Not of great help, the closest I could find was this <a href="http://forums.devshed.com/javascript-development-115/getelementsbytagname-script-doesn-t-work-properly-after-an-ajax-call-643454.html">unanswered forum post</a>.</p>
<p><span style="font-size:85%">(<a href="http://www.flickr.com/photos/jeffwilcox/274724789/">Image from Flickr</a>)</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2009/11/ie-and-script-loading-via-ajax.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A-void(0) javascript:void(0)</title>
		<link>http://blog.mbaierl.com/2009/09/a-void0-javascriptvoid0.html</link>
		<comments>http://blog.mbaierl.com/2009/09/a-void0-javascriptvoid0.html#comments</comments>
		<pubDate>Mon, 14 Sep 2009 10:08:00 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://test.mbaierl.com/2009/09/a-void0-javascriptvoid0.html</guid>
		<description><![CDATA[Today seems to be the day of IE6 bugs&#8230; the rather old &#8220;comma-bug&#8221; caused some troubles in one app and another one did not work properly in IE6. The following code was involved: &#60;a href=&#8221;javascript:void(0)&#8221; onclick=&#8221;someFunc()&#8221;&#62;my link&#60;/a&#62; The someFunc() dynamically loaded a new script file &#8211; which worked fine in all browsers except for Internet [...]]]></description>
			<content:encoded><![CDATA[<p>Today seems to be the day of IE6 bugs&#8230; the rather old &#8220;<a href="http://mbaierl.com/blog/2009/01/expected-identifier-string-or-number.html">comma-bug</a>&#8221; caused some troubles in one app and another one did not work properly in IE6. The following code was involved:<br />
<blockquote>&lt;a href=&#8221;javascript:void(0)&#8221; onclick=&#8221;someFunc()&#8221;&gt;my link&lt;/a&gt;</p></blockquote>
<p>The someFunc() dynamically loaded a new script file &#8211; which worked fine in all browsers except for Internet Explorer 6 &#8211; the file was never loaded. Reason for this is that javascript:void(0) terminates all loading, including newly added &amp;ltscript&gt; tags or <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XHR</a> requests.</p>
<p>Solving this is quite simple &#8211; the default handler of the link must never be executed:<br />
<blockquote>&lt;a href=&#8221;javascript:void(0)&#8221; onclick=&#8221;someFunc(); <span style="font-weight: bold">return false;</span>&#8220;&gt;my link&lt;/a&gt;</p></blockquote>
<p>But because there are more issues around the javascript: pseudo protocol I highly recommend not using javascript:void(0) at all. Instead use the following code:<br />
<blockquote>&lt;a href=&#8221;<span style="font-weight: bold">#</span>&#8221; onclick=&#8221;someFunc(); <span style="font-weight: bold">return false;</span>&#8220;&gt;my link&lt;/a&gt;</p></blockquote>
<p>In the worst case the default handler is executed, which means the site goes to an empty anchor&#8230; in practice this means the &#8220;#&#8221; is appended to the URL, that&#8217;s it. No scary JavaScript function involved, that only breaks IE6. And shorter to type too.</p>
<p>More information: <a href="http://blog.reindel.com/2006/08/11/a-hrefjavascriptvoid0-avoid-the-void/">here</a> and <a href="http://bytes.com/topic/javascript/answers/439866-ie-6-javascript-void-0-stops-webpage-loading">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2009/09/a-void0-javascriptvoid0.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Dojo tooltips based on the title tag</title>
		<link>http://blog.mbaierl.com/2009/04/display-dojo-tooltips-based-on-the-title-tag.html</link>
		<comments>http://blog.mbaierl.com/2009/04/display-dojo-tooltips-based-on-the-title-tag.html#comments</comments>
		<pubDate>Tue, 21 Apr 2009 06:06:00 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://test.mbaierl.com/2009/04/display-dojo-tooltips-based-on-the-title-tag.html</guid>
		<description><![CDATA[Recently I had to add nice tooltips to a larger Web application that is based on the Dojo framework. I thought &#8220;nothing easier that that&#8221;, as with jQuery I can do stuff like jQuery('a').tooltip(); with some (optional) parameters and that&#8217;s it. Unfortunately I had to learn from the various sources and samples that this simple [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to add nice tooltips to a larger Web application that is based on the <a href="http://www.dojotoolkit.org/">Dojo</a> framework. I thought &#8220;nothing easier that that&#8221;, as with <a href="http://jquery.com/">jQuery</a> I can do stuff like</p>
<blockquote>
<pre>jQuery('a').tooltip();</pre>
</blockquote>
<p>with some <a href="http://docs.jquery.com/Plugins/Tooltip">(optional) parameters</a> and that&#8217;s it. Unfortunately I had to learn from the various sources and <a href="http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/test_Tooltip.html">samples</a> that this simple feature is not supported out of the box by Dojo. There is a way of creating tooltips on the fly but there does not seem to be a ready-to-use solution which uses the title tag of the elements and shows a tooltip based on that.</p>
<p>So here is the code I came up with to <span style="font-weight: bold">display Dojo tooltips based on the title tag</span>:</p>
<blockquote>
<pre>dojo.addOnLoad(function() {
  //render each tooltip
  var i = 0;
  dojo.query(".withTooltip").forEach(function(node) {
      if(!node.title)
          return; // don't do anything if there is no title
      if(!node.id) // Dojo requires an ID for the element
      {
          node.id = "dojoToolTip-"+i;
          i++;
      }
      var tt = new dijit.Tooltip({label:node.title, connectId:[node.id]});
      node.title = ""; // remove the Browsers standard title tag
  });
});</pre>
</blockquote>
<p>The code selects all elements with the class &#8220;withTooltip&#8221; and creates a Tooltip dijit for each of the found elements. It is important to notice that an ID is being added in case there is none &#8211; <a href="http://www.dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/user-assistance-and-feedback/tooltip">dijit.Tooltip</a> requires an id and does not seem to work with classes or just an element being specified.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2009/04/display-dojo-tooltips-based-on-the-title-tag.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expected identifier, string or number</title>
		<link>http://blog.mbaierl.com/2009/01/expected-identifier-string-or-number.html</link>
		<comments>http://blog.mbaierl.com/2009/01/expected-identifier-string-or-number.html#comments</comments>
		<pubDate>Mon, 26 Jan 2009 15:12:00 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://test.mbaierl.com/2009/01/expected-identifier-string-or-number.html</guid>
		<description><![CDATA[A very interesting but kept me busy now for quite some time, the following code does not work in IE: var list = ["a", "b", "c", ]; As the code has been way more complex it was a bit harder to find the extra comma at the end and interestingly I already read about this [...]]]></description>
			<content:encoded><![CDATA[<p>A very interesting but kept me busy now for quite some time, the following code does not work in IE:<br />
<blockquote>var list = ["a", "b", "c", ];</p></blockquote>
<p>As the code has been way more complex it was a bit harder to find the extra comma at the end and interestingly <a href="http://www.atmedia.net/KlausRusch/blog/2008/08/undefined-is-null-or-not-object.html">I already read about this</a> a while ago&#8230; shame on me!</p>
<p>Nevertheless the error message is scary and useless:<br /><img style="margin: 0px auto 10px;text-align: center;width: 435px;height: 292px" src="http://mbaierl.com/blog/uploaded_images/ieerror-741271.png" alt="" border="0" /><br /><a href="http://www.dearie6.com/">IE6, please leave now!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2009/01/expected-identifier-string-or-number.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optimiert für IE6 und JavaScript</title>
		<link>http://blog.mbaierl.com/2008/12/optimiert-fur-ie6-und-javascript.html</link>
		<comments>http://blog.mbaierl.com/2008/12/optimiert-fur-ie6-und-javascript.html#comments</comments>
		<pubDate>Thu, 25 Dec 2008 21:40:00 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[deutsch]]></category>

		<guid isPermaLink="false">http://test.mbaierl.com/2008/12/optimiert-fur-ie6-und-javascript.html</guid>
		<description><![CDATA[Das tut weh, wenn ich so etwas lese:Besonders die Kombination aus dem Copyright 2008 und dem &#8220;Browser&#8221; IE6 sowie der Einsatz von JavaScript, welcher für diese Site absolut nicht notwendig ist, macht mich traurig.Sehr traurig. Belustigend finde ich hingegen, dass in der Anleitung erklärt wird wie man im Netscape JavaScript aktiviert&#8230; dieser Browser ist nämlich [...]]]></description>
			<content:encoded><![CDATA[<p>Das tut weh, wenn ich so etwas lese:<br /><img style="margin: 0px auto 10px;text-align: center;width: 430px;height: 31px" src="http://mbaierl.com/blog/uploaded_images/g-ie6-795335.png" alt="" border="0" />Besonders die Kombination aus dem Copyright 2008 und dem &#8220;Browser&#8221; <a href="http://de.wikipedia.org/wiki/Windows_Internet_Explorer#Die_Versionen_5.x_und_6.0">IE6</a> sowie der Einsatz von JavaScript, welcher für diese Site absolut nicht notwendig ist, macht mich traurig.<br /><img style="margin: 0px auto 10px;text-align: center;width: 251px;height: 36px" src="http://mbaierl.com/blog/uploaded_images/g-js-795339.png" alt="" border="0" />Sehr traurig.</p>
<p>Belustigend finde ich hingegen, dass in der Anleitung erklärt wird wie man im <a href="http://de.wikipedia.org/wiki/Netscape_Navigator">Netscape</a> JavaScript aktiviert&#8230; dieser Browser ist nämlich wirklich tot, IE6 hält sich ja leider trotz seines hohen Alters und zum Leidwesen von tausenden Webdesignern nach wie vor&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbaierl.com/2008/12/optimiert-fur-ie6-und-javascript.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: blog.mbaierl.com @ 2012-02-07 12:38:17 -->
