<?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: JavaScript Tip: Watch out for &#8220;+&#8221;</title>
	<atom:link href="http://ajaxian.com/archives/javascript-tip-watch-out-for/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/javascript-tip-watch-out-for</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 17 May 2012 07:43:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Tom</title>
		<link>http://ajaxian.com/archives/javascript-tip-watch-out-for/comment-page-1#comment-2549</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Wed, 18 Jan 2006 17:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-tip-watch-out-for#comment-2549</guid>
		<description>I agree with Lon&#039;s opinion on getLeft() and getBorderLeft(). If you and Numbers in JavaScript, you get a Number out. Based on the report, it seems like the original difficulty with Safari was that el.offsetTop and friends were Strings. And since these properties aren&#039;t part of any spec, ... But still, I think it would be in Apple&#039;s interest to conform to status quo (especially for the non-spec things).

And on a side note, this isn&#039;t about weak typing but dynamic typing (in this case). Python could have a similar issue here. JavaScript does tend to have weaker typing with some operators though (like &quot;==&quot; and such).</description>
		<content:encoded><![CDATA[<p>I agree with Lon&#8217;s opinion on getLeft() and getBorderLeft(). If you and Numbers in JavaScript, you get a Number out. Based on the report, it seems like the original difficulty with Safari was that el.offsetTop and friends were Strings. And since these properties aren&#8217;t part of any spec, &#8230; But still, I think it would be in Apple&#8217;s interest to conform to status quo (especially for the non-spec things).</p>
<p>And on a side note, this isn&#8217;t about weak typing but dynamic typing (in this case). Python could have a similar issue here. JavaScript does tend to have weaker typing with some operators though (like &#8220;==&#8221; and such).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lon</title>
		<link>http://ajaxian.com/archives/javascript-tip-watch-out-for/comment-page-1#comment-2542</link>
		<dc:creator>Lon</dc:creator>
		<pubDate>Wed, 18 Jan 2006 08:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-tip-watch-out-for#comment-2542</guid>
		<description>Oh and another thing:

&quot;
The simple fix in this case was to wrap the calls with parseInt:
return parseInt(getLeft(el)) + parseInt(getBorderLeft(el));
&quot;
This to me seems a very bad way of doing things. The methods getLeft and getBorderLeft should return integers. What are they returning now? &quot;30px&quot; or &quot;2em&quot;? You have to trust these methods and you can only trust them if they return proper integers, expressing whatever the express in a certain choosen unit, probably &quot;px&quot;. They should, after all, get you the left and borderLeft... What does that mean by the way... getBorderLeft? Do you mean getBorderLeftWidth?</description>
		<content:encoded><![CDATA[<p>Oh and another thing:</p>
<p>&#8221;<br />
The simple fix in this case was to wrap the calls with parseInt:<br />
return parseInt(getLeft(el)) + parseInt(getBorderLeft(el));<br />
&#8221;<br />
This to me seems a very bad way of doing things. The methods getLeft and getBorderLeft should return integers. What are they returning now? &#8220;30px&#8221; or &#8220;2em&#8221;? You have to trust these methods and you can only trust them if they return proper integers, expressing whatever the express in a certain choosen unit, probably &#8220;px&#8221;. They should, after all, get you the left and borderLeft&#8230; What does that mean by the way&#8230; getBorderLeft? Do you mean getBorderLeftWidth?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lon</title>
		<link>http://ajaxian.com/archives/javascript-tip-watch-out-for/comment-page-1#comment-2541</link>
		<dc:creator>Lon</dc:creator>
		<pubDate>Wed, 18 Jan 2006 08:45:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-tip-watch-out-for#comment-2541</guid>
		<description>This getStyle method at the end is very strange... what does it do? It takes an id or an element (why not be clear and have it take one or the other?) and it returns either the style or the currentStyle/computedStyle for that prop (or styleProp, little bug there).
Those are very different! Who would want a method that returns style or if absent currentStyle? Style could be set to &quot;auto&quot; while currentStyle returns &quot;60px&quot;. Which one do you need? The two are very different.</description>
		<content:encoded><![CDATA[<p>This getStyle method at the end is very strange&#8230; what does it do? It takes an id or an element (why not be clear and have it take one or the other?) and it returns either the style or the currentStyle/computedStyle for that prop (or styleProp, little bug there).<br />
Those are very different! Who would want a method that returns style or if absent currentStyle? Style could be set to &#8220;auto&#8221; while currentStyle returns &#8220;60px&#8221;. Which one do you need? The two are very different.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralesk Neâ€™vennoyx</title>
		<link>http://ajaxian.com/archives/javascript-tip-watch-out-for/comment-page-1#comment-2525</link>
		<dc:creator>Ralesk Neâ€™vennoyx</dc:creator>
		<pubDate>Tue, 17 Jan 2006 20:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-tip-watch-out-for#comment-2525</guid>
		<description>The JavaScript â€˜+â€™ operator always reminds me of why I love Perl.</description>
		<content:encoded><![CDATA[<p>The JavaScript â€˜+â€™ operator always reminds me of why I love Perl.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacob Munson</title>
		<link>http://ajaxian.com/archives/javascript-tip-watch-out-for/comment-page-1#comment-2523</link>
		<dc:creator>Jacob Munson</dc:creator>
		<pubDate>Tue, 17 Jan 2006 19:59:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-tip-watch-out-for#comment-2523</guid>
		<description>Is it just me, or is Safari the worst browser to code for when it comes to JavaScript?  I usually use Firefox to code my projects, so I never have problems there (any problems are fixed before trying other browsers).  Most stuff I try works out of the box in IE/Opera, but I seem to have the most problems with Safari.  Part of my issue is that I don&#039;t have access to Safari to test things, but it does seem that Safari has run astray in the JS world.</description>
		<content:encoded><![CDATA[<p>Is it just me, or is Safari the worst browser to code for when it comes to JavaScript?  I usually use Firefox to code my projects, so I never have problems there (any problems are fixed before trying other browsers).  Most stuff I try works out of the box in IE/Opera, but I seem to have the most problems with Safari.  Part of my issue is that I don&#8217;t have access to Safari to test things, but it does seem that Safari has run astray in the JS world.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Wubben</title>
		<link>http://ajaxian.com/archives/javascript-tip-watch-out-for/comment-page-1#comment-2522</link>
		<dc:creator>Mark Wubben</dc:creator>
		<pubDate>Tue, 17 Jan 2006 19:44:38 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-tip-watch-out-for#comment-2522</guid>
		<description>Actually Safari&#039;s implementation of &lt;code&gt;getComputedStyle()&lt;/code&gt; is conform the standard. It just turns out that Firefox and Opera reference &lt;code&gt;document.defaultView&lt;/code&gt; to &lt;code&gt;window&lt;/code&gt;. From what I can see in the code example Safari doesn&#039;t return numbers where you&#039;d expect them, &lt;code&gt;offset&lt;/code&gt; values don&#039;t normally return as strings with a pixel unit. That would be the root cause, and that&#039;s where the fix should be placed.</description>
		<content:encoded><![CDATA[<p>Actually Safari&#8217;s implementation of <code>getComputedStyle()</code> is conform the standard. It just turns out that Firefox and Opera reference <code>document.defaultView</code> to <code>window</code>. From what I can see in the code example Safari doesn&#8217;t return numbers where you&#8217;d expect them, <code>offset</code> values don&#8217;t normally return as strings with a pixel unit. That would be the root cause, and that&#8217;s where the fix should be placed.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

