<?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>Purple Ivy - Asheville Website Design and Consulting &#187; Development Tips</title>
	<atom:link href="http://www.purpleivy.net/topics/development-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.purpleivy.net</link>
	<description>Elegant, Organic, and Original Design</description>
	<lastBuildDate>Tue, 12 Oct 2010 17:41:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Including JQuery Multiple Times</title>
		<link>http://www.purpleivy.net/web-design/development-tips/2010/03/including-jquery-multiple-times/</link>
		<comments>http://www.purpleivy.net/web-design/development-tips/2010/03/including-jquery-multiple-times/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 14:33:41 +0000</pubDate>
		<dc:creator>Sha</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.purpleivy.net/?p=101</guid>
		<description><![CDATA[Do you want to prevent loading JQuery twice?  JQuery (at least through 1.4) doesn&#8217;t work when you include it more than once. At work I ran across a strange problem that often comes up in content management systems.  The scenario works like this: The content management system uses JQuery in its latest version but not [...]]]></description>
			<content:encoded><![CDATA[<p>Do you want to prevent loading JQuery twice?  JQuery (at least through 1.4) doesn&#8217;t work when you include it more than once.</p>
<p>At work I ran across a strange problem that often comes up in content management systems.  The scenario works like this:</p>
<ul>
<li>The content management system uses JQuery in its latest version but not in earlier versions</li>
<li>A skin designer uses JQuery in the design of a skin</li>
<li>A plugin developer uses JQuery in the implementation of a plugin</li>
<li>Someone who writes custom content for a page wants to use JQuery for a page</li>
</ul>
<p>All these different people want to use JQuery &#8211; but the JQuery framework does not function properly if it is included more than once on a web page.  There&#8217;s also no conditional include in HTML (or any include functionality at all, which I&#8217;ve always thought to be a glaring omission).</p>
<p>I wrote a wrapper that you can include instead of JQuery that doesn&#8217;t include JQuery if it&#8217;s already there. It&#8217;s based up on a <a title="JQuery Include Wrapper" href="http://stackoverflow.com/questions/274899/clean-way-of-having-jquery-includes-with-asp-net-mvc/274906#274906" target="_blank">post by FlySwat </a>but the problem with FlySwat&#8217;s is that you have to put some extra code in front of your JQuery code every time. To use my version of the wrapper, all you have to do is use a different function other than $(document).ready to start your scripts at page ready time.</p>
<p>Here&#8217;s my &#8220;jquery.js&#8221; which you can put on a page as often as you like:</p>
<blockquote>
<pre>if (typeof(loadJSInclude) == 'undefined') {
 function loadJSInclude(scriptPath, callback)
 {
   var scriptNode = document.createElement('SCRIPT');
   scriptNode.type = 'text/javascript';
   scriptNode.src = scriptPath;

   var headNode = document.getElementsByTagName('HEAD');
   if (headNode[0] != null)
      headNode[0].appendChild(scriptNode);

   if (callback != null)    
   {
     scriptNode.onreadystagechange = callback;            
     scriptNode.onload = callback;
   }
 }

 function loadJQuery(task) {
   if (typeof(jquery) == "undefined")
   loadJSInclude('/js/jquery-1.4.1.min.js', function() {
     $(document).ready(task)
   });
   else
     $(document).ready(task());
 }
}</pre>
</blockquote>
<p>And then, to start your JQuery operations, use loadJQuery()  instead of $(document).ready()</p>
<blockquote>
<pre>loadJQuery(function () {
  .. your jquery stuff here ..
  $('#boomboom').click( function() {
  alert("BOOM!");
  });
);</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.purpleivy.net/web-design/development-tips/2010/03/including-jquery-multiple-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE-only CSS for Your Sanity</title>
		<link>http://www.purpleivy.net/web-design/development-tips/2009/07/ie-only-css-for-your-sanity/</link>
		<comments>http://www.purpleivy.net/web-design/development-tips/2009/07/ie-only-css-for-your-sanity/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 07:07:01 +0000</pubDate>
		<dc:creator>Sha</dc:creator>
				<category><![CDATA[Development Tips]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.purpleivy.net/?p=22</guid>
		<description><![CDATA[I stumbled upon an accident the other day. One of those oh wow moments.  Haven&#8217;t you always been a bit ticked off how Microsoft has gone and decided their own way of implementing many things in CSS, deciding to be different where the standard doesn&#8217;t specify, if only to be a pain in the&#8230;.. yeah. [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon an accident the other day. One of those oh wow moments.  Haven&#8217;t you always been a bit ticked off how Microsoft has gone and decided their own way of implementing many things in CSS, deciding to be different where the standard doesn&#8217;t specify, if only to be a pain in the&#8230;.. yeah.</p>
<p>You know the story.  CSS differences between IE and Firefox / Opera / Safari / Chrome / Everyone Else have always been a pain.</p>
<p>Well, as it turns out, most browsers use C-Style comments in their CSS.  C has two style of comments:  /* Like this */ which comments out a block, and // Like This</p>
<p>The above comments everything after the // on the line.</p>
<p>I haven&#8217;t found // in the CSS standard, and &#8230; IE just ignores these characters.  It proccesses anything after the // as if the // wasn&#8217;t there at all.  Other browsers seem to think it&#8217;s a comment, and ignore the // and everything after.</p>
<p>In other words if you have this tag:</p>
<p style="padding-left: 30px;">#myblock {<br />
margin: 0px;<br />
// margin: 10px;<br />
}</p>
<p>IE will use a margin of 10px, and all the other browsers: 0px.</p>
<p>I haven&#8217;t tested it out with IE8 yet.  But works in IE6 and 7 which are the biggest pains anyway.</p>
<p>I&#8217;ll come up with a better example later but this is HUGE!  Now we can put IE-specific CSS in our CSS files, to make IE do things that the other browsers will just ignore!</p>
<p>Of course, anyone that&#8217;s reading this that&#8217;s using IE6 or IE7 &#8211; UPGRADE.  You are exposing yourself to serious security problems.  Latest news is that these old browsers are susceptible to virus attacks that can take over your machine.  I&#8217;ve a mind to make my websites display &#8220;Upgrade your browser &#8211; You&#8217;re in DANGER!&#8221; if they are using an old version of IE.</p>
<p>Now, I could do that conditional stuff with just CSS!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.purpleivy.net/web-design/development-tips/2009/07/ie-only-css-for-your-sanity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

