<?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>playground @ onereason</title>
	<atom:link href="http://playground.onereason.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://playground.onereason.eu</link>
	<description>A little bit of this, a little bit of that, but probably mainly javascript</description>
	<lastBuildDate>Thu, 19 May 2011 15:38:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Making sense of the geolocation api</title>
		<link>http://playground.onereason.eu/2011/05/making-sense-of-the-geolocation-api/</link>
		<comments>http://playground.onereason.eu/2011/05/making-sense-of-the-geolocation-api/#comments</comments>
		<pubDate>Thu, 19 May 2011 15:37:11 +0000</pubDate>
		<dc:creator>Suhi</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://playground.onereason.eu/?p=72</guid>
		<description><![CDATA[Ever since I could connect wires, I liked electronics giving feedback about changes in the physical world. During my highschool years this was demostrated by my little door switches and LED indicators setup, so I would get an early warning when my parents came home. Many years later I was completely blown away when a [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I could connect wires, I liked electronics giving feedback about changes in the physical world. During my highschool years this was demostrated by my little door switches and LED indicators setup, so I would get an early warning when my parents came home. <img src='http://playground.onereason.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Many years later I was completely blown away when a mobile device showed where I was and with great precision. My enthusiasm might have faded somewhat over the years, but location was still the first thing I started playing with recently, during the <a href="http://www.phonegap.com/">PhoneGap</a> <a href="http://mobilism.nl/2011/workshops">workshop</a> at <a href="http://mobilism.nl/">Mobilism</a>.</p>
<p>To get all the info possible about my location, my demo app utilised both the <a href="http://docs.phonegap.com/phonegap_geolocation_geolocation.md.html#geolocation.watchPosition">geolocation</a> and <a href="http://docs.phonegap.com/phonegap_compass_compass.md.html#compass.watchHeading">compass</a> APIs and worked like a charm. Looking at the specs, in particular the <a href="http://dev.w3.org/geo/api/spec-source.html#geolocation_interface">coordinates interface</a>, something started to bug me. It didn&#8217;t make sense! According to the w3c spec ( which PhoneGap&#8217;s API is based on ):</p>
<pre>interface <dfn id="coordinates">Coordinates</dfn> {
    readonly attribute double <a href="http://dev.w3.org/geo/api/spec-source.html#lat">latitude</a>;
    readonly attribute double <a href="http://dev.w3.org/geo/api/spec-source.html#lon">longitude</a>;
    readonly attribute double? <a href="http://dev.w3.org/geo/api/spec-source.html#altitude">altitude</a>;
    readonly attribute double <a href="http://dev.w3.org/geo/api/spec-source.html#accuracy">accuracy</a>;
    readonly attribute double? <a href="http://dev.w3.org/geo/api/spec-source.html#altitude-accuracy">altitudeAccuracy</a>;
    readonly attribute double? <a href="http://dev.w3.org/geo/api/spec-source.html#heading">heading</a>;
    readonly attribute double? <a href="http://dev.w3.org/geo/api/spec-source.html#speed">speed</a>;
  };</pre>
<p>I would like to point out that <em>heading</em> here denotes the direction of travel and must return NaN when <em>speed</em> is zero. The compass on the other hand simply &#8220;Obtains the direction that the device is pointing&#8221;, returning a single value for <em>heading</em>. Now there is w3c spec for compass, but I think these APIs need to be sorted out nonetheless.</p>
<p>First of all, I think the position and movement describing APIs should either be seperated or united in a much more logical manner. <em>Lo·ca·tion </em>by <a href="http://www.google.com/search?aq=0&amp;oq=location+defi&amp;q=location+definition">definition</a>, refers to a particular place or position, so should contain attributes needed to describe just that, namely <em>latitude</em>, <em>longitude</em>, <em>altitude</em> and <em>heading</em> ( will skip the <em>accuracy</em> attributes ). Almost the same, right? Well, 75% true. The first 3 attributes are the same as in today&#8217;s spec, but the <em>heading</em> attribute in geolocation should refer to what is returned from the compass API, the direction the device is pointing. After all I can easily stand in one place, turn in any direction and my location should reflect this.</p>
<p><em>Ve·loc·i·ty,</em> by definition, is the speed of something in a given direction. This is what the <em>speed</em> and <em>heading</em> attributes of the current geolocation API return, but these should NOT be inside geolocation, since they are not describing a particular place or position. These attributes should be in a seperate, let&#8217;s say, geovelocity API or simply velocity API.</p>
<p>If you are all confused now, here&#8217;s an example to imagine: You are sitting in a car travelling west while staring out the window facing north, taking pictures with your device. The location of any photo taken should describe its geographic coordinates, plus that your lense was looking towards the north. On the other hand a navigation app should continue to update the map showing the direction the car is moving in, so in this case, west. Did that help?</p>
<p>So to sum it all up, I suggest 2 APIs:</p>
<pre>geolocation {
    latitude;
    longitude;
    altitude;
    heading;
}</pre>
<pre>velocity {
    speed;
    heading;
}</pre>
<p>I could imagine another solution, for the sake of backwards compatibility, where all attributes remain inside the geolocation, but this would require a straight forward, clear word as attribute name for the compass&#8217; direction. One that doesn&#8217;t refer to both the way something is pointing and moving. I prefer the previous.</p>
<p>What do you think?</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;count=horizontal&amp;text=Making%20sense%20of%20the%20geolocation%20api" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;count=horizontal&amp;text=Making%20sense%20of%20the%20geolocation%20api" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fplayground.onereason.eu%2F2011%2F05%2Fmaking-sense-of-the-geolocation-api%2F&amp;title=Making%20sense%20of%20the%20geolocation%20api">Share</a> </p>]]></content:encoded>
			<wfw:commentRss>http://playground.onereason.eu/2011/05/making-sense-of-the-geolocation-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image size limitation on the iPad</title>
		<link>http://playground.onereason.eu/2010/11/image-size-limitation-on-the-ipad/</link>
		<comments>http://playground.onereason.eu/2010/11/image-size-limitation-on-the-ipad/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 21:53:59 +0000</pubDate>
		<dc:creator>Suhi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gif]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[jpg]]></category>
		<category><![CDATA[limitation]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://playground.onereason.eu/?p=66</guid>
		<description><![CDATA[On a current project I&#8217;m building an image viewer for the iPad using html and javascript. The plan is to make it resemble the native Photo browser giving the user a familiar interface with pinch / double-tap zoom, etc. I built a prototype with a few portrait images and it worked like a charm. Then [...]]]></description>
			<content:encoded><![CDATA[<p>On a current project I&#8217;m building an image viewer for the iPad using html and javascript. The plan is to make it resemble the native Photo browser giving the user a familiar interface with pinch / double-tap zoom, etc. I built a prototype with a few portrait images and it worked like a charm. Then the client extended the library to contain more images with different proportions and things weren&#8217;t working so smoothly any more. I have to add here, that this is part of a larger web app where everything happens without a single reload, so a great deal of things get  loaded into memory&#8230;</p>
<p>Problem 1: Crash! Yep, it seems that after a while, probably meaning that a great number of images have been viewed, the browser crashes. Basically a too-many-images-on-the-page issue, but &#8216;luckily&#8217; <a href="http://roblaplaca.com/blog/2010/05/05/ipad-safari-image-limit-workaround/">someone</a> has met it before and has come up with a solution. Although untested, I have my hopes up based his test page&#8230;</p>
<p>Problem 2: I saved all images to be 1.5 times the screen size, so extra details can be seen when zoomed in. All was well until the client added landscape images that were larger and yet didn&#8217;t result in more details. At first we suspected some bug in the script, an error in a sizing calculation, but no, that just took the dimensions of the image from the browser. So I started playing with images inside the project, and I soon realized that this had nothing to do with the project. This was something safari did! I quickly wrote a <a href="http://playground.onereason.eu/test/imagesizelimit/">simple page</a> to generate ever larger images in different formats, and answer soon became obvious. Safari resizes jpegs larger than 2MP ( 2,000,000 pixels ). A 2000&#215;1000 pixel image is exactly that big according to the browser too, but 2000&#215;1001 suddenly became 1000&#215;501. Now I did mention that this was the case for jpegs, but as it turns out, it isn&#8217;t so for gifs or pngs. With those blessed formats I haven&#8217;t run into any issues on scales that matter here. I totally understand that you might be sceptical of my testing methods ( so was I for a while ), so feel free to take a <a href="http://www.google.com/images?q=ipad&amp;hl=en&amp;biw=1367&amp;bih=739&amp;tbs=isch:1,isz:lt,islt:4mp&amp;prmd=ivns&amp;source=lnt">google image search result page</a> on your iDevice, check out a few big pngs and jpegs&#8230;</p>
<p>Now, of course these problems can be overcome if you know about them well in advance, during the planning stage of your project. Unfortunatelly, I am now well past the middle, so major changes have to be made to remedy them. I just hope that me writing about it will save you some trouble and time!</p>
<p>Update (2010-11-05): The app kept crashing the browser even after the canvas trick has been implemented, so I kept on searching. The solution came from the maker of the famous <a href="http://www.malsup.com/jquery/cycle/ipad.html">jquery cycle plugin</a>. It involves replacing all out of view images  ( and canvas content ) with a 1px gif. This seems to free up the memory and save the app. Hurray, the gallery with several large images and zoom feature is now running smooth!</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;count=horizontal&amp;text=Image%20size%20limitation%20on%20the%20iPad" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;count=horizontal&amp;text=Image%20size%20limitation%20on%20the%20iPad" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F11%2Fimage-size-limitation-on-the-ipad%2F&amp;title=Image%20size%20limitation%20on%20the%20iPad">Share</a> </p>]]></content:encoded>
			<wfw:commentRss>http://playground.onereason.eu/2010/11/image-size-limitation-on-the-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twisting box-shadows to make a pretty business card</title>
		<link>http://playground.onereason.eu/2010/10/add-your-business-card-in-css3/</link>
		<comments>http://playground.onereason.eu/2010/10/add-your-business-card-in-css3/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 21:51:31 +0000</pubDate>
		<dc:creator>Suhi</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[::after]]></category>
		<category><![CDATA[::before]]></category>
		<category><![CDATA[box-shadow]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[shadow]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://playground.onereason.eu/?p=51</guid>
		<description><![CDATA[Like half the web developer community, I&#8217;ve been fiddling around in the css3 magic chest myself. Building beautiful, decorated pages with no images is a fun challenge I much enjoy, even though I know these features have limited use in real production sites. At least for desktops. But if you are building a web app, [...]]]></description>
			<content:encoded><![CDATA[<p>Like half the web developer community, I&#8217;ve been fiddling around in the css3 magic chest myself. Building beautiful, decorated pages with no images is a fun challenge I much enjoy, even though I know these features have limited use in real production sites. At least for desktops. But if you are building a web app, or an optimized page for iDevices or smartphones with webkit browsers, you can pretty much go wild!</p>
<p>Well, redoing my own site, I let myself get a little carried away too, and so I ended up building my business card in html. Of course, I wanted to keep the number of &lt;div&gt;s to no more than the number of pieces in the real world. One business card and one holder it is attached to.</p>
<pre>&lt;div class="business-card-holder"&gt;
	&lt;div class="business-card" href="#balazs"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>And the result:</p>
<div class="iframe-wrapper">
  <iframe src="/frames/businesscard/index.html" frameborder="0" style="height:210px;width:580px;">Please upgrade your browser</iframe>
</div>
<p>Before you say anything, of course the logo is an image. No reason that shouldn&#8217;t be. But everything else is just css3. To build the card and its holder I would have needed 5 elements, but luckily with <a href="http://www.w3.org/TR/css3-content/#pseudo-elements" target="_blank">pseudo-element selectors</a><em> </em>like ::before and ::after I could create those from the css without polluting the clean markup.</p>
<p>Firstly the holder got 2 extra blocks to create the little slots the card slides into. These are just 2 rotated rectagles with shadows, cut off by the holder&#8217;s overflow: hidden. The tricky part was trying to get the shadow of the card to be larger in the other 2 corners, where it isn&#8217;t held down by the slots. After quite some fiddling I arrived at the business-card div becoming a skewed and rotated shadow with -prefix-tranform. Its ::after pseudo element ( reversing the skew and rotation ) became the white paper of the card containing the text. Now because of all this twisting and turning the child elements of the card needed to be adjusted too so they aligned straight and square. As a finishing touch, following the advice of a gifted colleague of mine, a barely visible gradient was added to the &#8216;paper&#8217; of the card, adding to the sense that it is ever so slightly curved.</p>
<p>As with most css3 adventures, compatibility is limited to modern broswers, but I am curious what it will look like in the version final ie9. Is there hope?</p>
<p>Anyways, I think it turned out quite nice. If you like it, feel free to <a href="/frames/businesscard/businesscard.zip" target="_blank">download</a> it, and do as you wish with it. But if you don&#8217;t like it&#8230; tell me why not?</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;count=horizontal&amp;text=Twisting%20box-shadows%20to%20make%20a%20pretty%20business%20card" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;count=horizontal&amp;text=Twisting%20box-shadows%20to%20make%20a%20pretty%20business%20card" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F10%2Fadd-your-business-card-in-css3%2F&amp;title=Twisting%20box-shadows%20to%20make%20a%20pretty%20business%20card">Share</a> </p>]]></content:encoded>
			<wfw:commentRss>http://playground.onereason.eu/2010/10/add-your-business-card-in-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3: Mask-image</title>
		<link>http://playground.onereason.eu/2010/07/css3-mask-image/</link>
		<comments>http://playground.onereason.eu/2010/07/css3-mask-image/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 08:58:07 +0000</pubDate>
		<dc:creator>Suhi</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[mask-image]]></category>
		<category><![CDATA[multicolumn]]></category>

		<guid isPermaLink="false">http://playground.onereason.eu/?p=46</guid>
		<description><![CDATA[A little fun with css3 dedicated to our soon to be born son: http://playground.onereason.eu/css3/our_sons_name/]]></description>
			<content:encoded><![CDATA[<p>A little fun with css3 dedicated to our soon to be born son: <a href="http://playground.onereason.eu/css3/our_sons_name/">http://playground.onereason.eu/css3/our_sons_name/</a></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;count=horizontal&amp;text=CSS3%3A%20Mask-image" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;count=horizontal&amp;text=CSS3%3A%20Mask-image" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F07%2Fcss3-mask-image%2F&amp;title=CSS3%3A%20Mask-image">Share</a> </p>]]></content:encoded>
			<wfw:commentRss>http://playground.onereason.eu/2010/07/css3-mask-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Padd-ache from webkit</title>
		<link>http://playground.onereason.eu/2010/04/padding-ache-in-webkit/</link>
		<comments>http://playground.onereason.eu/2010/04/padding-ache-in-webkit/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 15:55:13 +0000</pubDate>
		<dc:creator>Suhi</dc:creator>
				<category><![CDATA[bug]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[rendering]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://playground.onereason.eu/?p=28</guid>
		<description><![CDATA[I received a bug report not long ago about an issue in Chrome and Safari. Some text was covering part of an image although padding should have taken care of that. With both safari ( 4.0.5 ) and chrome ( 4.1.249.1045 ) fired up, I started playing with the css using their dev tools. Thinking [...]]]></description>
			<content:encoded><![CDATA[<p>I received a bug report not long ago about an issue in Chrome and Safari. Some text was covering part of an image although padding should have taken care of that. With both safari ( 4.0.5 ) and chrome ( 4.1.249.1045 ) fired up, I started playing with the css using their dev tools. Thinking that it will be some trivial issue, I changed some positions and margins, only to find out, that no matter what property I changed, the page would rerender, fixing my issue. Alright, so there goes the easy way out! Gotta try something else!</p>
<p>Since this page is cms generated, I resorted to saving the page from firefox to my harddrive. After I pointed all resources to the live site, the issue still existsed, so it was time to start hacking away all the pieces that were not needed to reproduce the error. I have to add here that I only had partial knowledge over the solutions used on the page&#8230;</p>
<p>It soon turned out, the padding was added with javascript after the image was done loading and it&#8217;s width could be determined. There doesn&#8217;t seem to be anything wrong with that, right? Right! But there seems to be something wrong with changing the padding of an element with javascript.</p>
<p>In the end my page was little more that this:</p>
<pre>&lt;div id="scripted_padding"&gt;
    &lt;p&gt;
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a purus eget velit pulvinar faucibus porta ac arcu. Cras vehicula urna odio, eu placerat sapien. Aenean commodo ipsum vitae lorem accumsan non posuere dui iaculis. Sed facilisis velit sit amet libero tristique eu porttitor ante blandit. Sed condimentum urna eget lacus molestie luctus. Curabitur ac iaculis urna. Etiam leo felis, sodales molestie sagittis eu, tincidunt ac nisl. Suspendisse et euismod dolor. Fusce mollis risus quis purus fringilla vel posuere dui aliquet. Sed et felis id est mollis ultrices in quis nunc. Nullam vel sapien sed nulla posuere condimentum.
    &lt;/p&gt;
&lt;/div&gt;</pre>
<p>I had 1 line of javascript adding padding-right to #scripted_padding and sure enough the text inside the p tag would still fill the whole width of the #scripted_padding element. I could see in both browser&#8217;s inspector, that the element did have padding, but the p tag seemed to ignore it.</p>
<p>I&#8217;ve thrown together a <a href="/test/webkit-padding.html" target="_blank">simple page</a> where you can test this yourself.</p>
<p>As a workaround I&#8217;ve added a .hide().show(1) after setting the padding in webkit, but I realize that this is, well, ugly and terrible, so I would love to hear a better solution to this problems!</p>
<p><em>Update [27/5/2010]: Just checked on my iPhone ( 3.1.3 ) and the issue exists there too!</em></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;count=horizontal&amp;text=Padd-ache%20from%20webkit" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;counturl=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;count=horizontal&amp;text=Padd-ache%20from%20webkit" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fplayground.onereason.eu%2F2010%2F04%2Fpadding-ache-in-webkit%2F&amp;title=Padd-ache%20from%20webkit">Share</a> </p>]]></content:encoded>
			<wfw:commentRss>http://playground.onereason.eu/2010/04/padding-ache-in-webkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

