<?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>Dylan Butler » San Diego Freelance Web Development and Consultation &#187; isancestor</title>
	<atom:link href="http://www.dylanbutler.com/tag/isancestor/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dylanbutler.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 09 Aug 2010 16:31:37 +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>Simple drop-downs using YAHOO.util.Dom.isAncestor</title>
		<link>http://www.dylanbutler.com/2009/05/simple-drop-downs-using-yahooutildomisancestor/</link>
		<comments>http://www.dylanbutler.com/2009/05/simple-drop-downs-using-yahooutildomisancestor/#comments</comments>
		<pubDate>Sat, 02 May 2009 17:03:01 +0000</pubDate>
		<dc:creator>Dylan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[drop down]]></category>
		<category><![CDATA[isancestor]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.dylanbutler.com/?p=109</guid>
		<description><![CDATA[The Yahoo! User Interface Library (YUI) has a bunch of very nifty little methods to make complex tasks easier. One that immediately stood out to me was isAncestor, as I can attest first-hand to the cross-browser troubles when trying to &#8230; <a href="http://www.dylanbutler.com/2009/05/simple-drop-downs-using-yahooutildomisancestor/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The Yahoo! User Interface Library (YUI) has a bunch of very nifty little methods to make complex tasks easier. One that immediately stood out to me was isAncestor, as I can attest first-hand to the cross-browser troubles when trying to detect ancestry in the DOM. Although a very basic concept, most drop-down code often becomes bloated or restrictive. I&#8217;m not advocating the use of JavaScript drop-downs over a CSS method, but there are some added benefits of using JS to achieve this effect:</p>
<ol>
<li>Clean markup, no need for conditional comments</li>
<li>The ability to animate show and hide events</li>
<li>Added styling opportunities, won&#8217;t break so long as the nested list structure remains in tact</li>
</ol>
<p>Below is a simple example of how to use YUI&#8217;s isAncestor to create flyout menus with HTML and CSS.</p>
<pre class="prettyprint">(function() {
	function mouseover(e) {
		var menu = this.getElementsByTagName('ul')[0];
		YAHOO.util.Dom.setStyle(menu, 'display', 'block');
	};

	function mouseout(e) {
		if (!YAHOO.util.Dom.isAncestor(this, e.relatedTarget) || e.relatedTarget == document.getElementsByTagName('html')[0]) {
			var menu = this.getElementsByTagName('ul')[0];
			YAHOO.util.Dom.setStyle(menu, 'display', 'none');
		}
	};
	YAHOO.util.Event.on(YAHOO.util.Dom.get('nav').getElementsByTagName('li'), 'mouseover', mouseover);
	YAHOO.util.Event.on(YAHOO.util.Dom.get('nav').getElementsByTagName('li'), 'mouseout', mouseout);
})();</pre>
<p><a href="/classwork/random/yui_dropdowns.htm">See Example »</a></p>
<p>If you need something more complex, see the <a href="/2008/08/yui-generic-showhide-code/">YUI MenuCreator</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dylanbutler.com/2009/05/simple-drop-downs-using-yahooutildomisancestor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
