<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://microformats.org/wiki/index.php?action=history&amp;feed=atom&amp;title=algorithm-nearest-in-parent-fr</id>
	<title>algorithm-nearest-in-parent-fr - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://microformats.org/wiki/index.php?action=history&amp;feed=atom&amp;title=algorithm-nearest-in-parent-fr"/>
	<link rel="alternate" type="text/html" href="http://microformats.org/wiki/index.php?title=algorithm-nearest-in-parent-fr&amp;action=history"/>
	<updated>2026-04-11T16:59:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>http://microformats.org/wiki/index.php?title=algorithm-nearest-in-parent-fr&amp;diff=32179&amp;oldid=prev</id>
		<title>ChristopheDucamp at 17:53, 7 August 2006</title>
		<link rel="alternate" type="text/html" href="http://microformats.org/wiki/index.php?title=algorithm-nearest-in-parent-fr&amp;diff=32179&amp;oldid=prev"/>
		<updated>2006-08-07T17:53:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Cet algorithme renverra tous les éléments dans un DOM qui rencontre le  &amp;lt;code&amp;gt;condition_test&amp;lt;/code&amp;gt; en vérifiant chaque noeud dans la hiérarchie parent au dessus de le &amp;lt;code&amp;gt;start_element&amp;lt;/code&amp;gt;. Une fois un résultat trouvé à n'importe quel niveau de la hiérarchie parent, nous arrêtons de vérifier.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
def nearest_in_parent(start_element, condition_test):&lt;br /&gt;
  p = start_element.parent&lt;br /&gt;
  while p:&lt;br /&gt;
    as = []&lt;br /&gt;
    for c in ordered_depth_first_element_iter(p):&lt;br /&gt;
      if condition_test(c):&lt;br /&gt;
        as.append(c)&lt;br /&gt;
&lt;br /&gt;
    if as:&lt;br /&gt;
      return as&lt;br /&gt;
&lt;br /&gt;
    p = p.parent&lt;br /&gt;
&lt;br /&gt;
  return None&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/noprri&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>ChristopheDucamp</name></author>
	</entry>
</feed>