<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/with_jquery.js</filename>
    </added>
    <added>
      <filename>test/with_mootools.js</filename>
    </added>
    <added>
      <filename>test/with_sizzle.js</filename>
    </added>
    <added>
      <filename>test/with_sly.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -46,8 +46,11 @@ $p.core = function(sel, ctxt, plugins){
 	plugins._error = error;
 
 	// set the signature string that will be replaced at render time
-	var Sig = 'r' + Math.floor( Math.random() * 1000000 ) + 'S';
-
+	var Sig = '_s' + Math.floor( Math.random() * 1000000 ) + '_';
+	
+	// keep the json data root
+	var json;
+	
 	return plugins;
 
 	/*
@@ -197,17 +200,19 @@ $p.core = function(sel, ctxt, plugins){
 	// wrap in an object the target node/attr and their properties
 	function gettarget(dom, sel, isloop){
 		var osel, prepend, selector, attr, append, target = [];
-		if(typeof sel === 'string'){
+		if( typeof sel === 'string' ){
 			osel = sel;
 			// e.g. &quot;+tr.foo[class]&quot;
 			var m = sel.match(/^\s*([\+=])?(((\+[^\[])|[^\[\+])*)(\[([^\]]*)\])?([\+=])?\s*$/);
-			if(!m){
-				error('bad selector: ' + sel);
+			if( !m ){
+				error( 'bad selector: ' + sel );
 			}
-			var prepend = m[1],
-				selector = m[2],
-				attr = m[6],
-				append = m[7];
+			
+			prepend = m[1];
+			selector = m[2];
+			attr = m[6];
+			append = m[7];
+			
 			if(selector === '.' || ( selector === '' &amp;&amp; typeof attr !== 'undefined' ) ){
 				target[0] = dom;
 			}else{
@@ -217,35 +222,46 @@ $p.core = function(sel, ctxt, plugins){
 				return {attr: null, nodes: target, set: null, sel: osel};
 			}
 		}else{
+			// autoRender node
 			prepend = sel.prepend;
 			attr = sel.attr;
 			append = sel.append;
 			target = [dom];
 		}
-		var mode = (attr || isloop) ? 'self' : 'contents';
-		if(prepend || append){
-			if(prepend &amp;&amp; append){
-				error('conflicting append/prepend/replace modifiers');
-			}
-			if(isloop){
+		
+		if( prepend || append ){
+			if( prepend &amp;&amp; append ){
+				error('append/prepend cannot take place at the same time');
+			}else if( isloop ){
 				error('no append/prepend/replace modifiers allowed for loop target');
-			}
-			var c = prepend || append;
-			mode = c === '=' ? 'self' : (append ? 'append' : 'prepend');
-			if(mode === 'append' &amp;&amp; isloop){
+			}else if( append &amp;&amp; isloop ){
 				error('cannot append with loop (sel: ' + osel + ')');
 			}
 		}
 		// we need 'root' selector because CSS search never finds the root element.
 		var setstr, getstr, quotefn;
 		if(attr){
-			getstr = function(node){return node.getAttribute(attr);};
-			setstr = function(node, s){node.setAttribute(attr, s);};
+			getstr = function(node){ 
+				if((/^style$/i).test(attr)){
+					var css = node.style.cssText;
+					node.removeAttribute( 'style' );
+					return css;
+				}else{
+					return node.getAttribute(attr); 					
+				}
+			};
+			setstr = function(node, s){
+				if((/^style$/i).test(attr)){
+					node.setAttribute( attr + Math.floor( Math.random() * 100000 ), s );
+				}else{
+					node.setAttribute(attr, s);
+				};
+			};
 			quotefn = function(s){
 				return s.replace(/\&quot;/g, '&amp;quot;').replace(/&amp;/g, '&amp;amp;').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;');
 			};
 		}else{
-			if(mode === 'self'){
+			if(isloop){
 				setstr = function(node, s){
 					// we can have a null parent node
 					// if we get overlapping targets.
@@ -258,23 +274,18 @@ $p.core = function(sel, ctxt, plugins){
 					}
 				};
 			}else{
-				getstr = function(node){return node.innerHTML;};
-				setstr = function(node, s){node.innerHTML = s;};
+				getstr = function(node){ return node.innerHTML; };
+				setstr = function(node, s){ node.innerHTML = s; };
 			}
-			quotefn = function(s){return s;};
+			quotefn = function(s){ return s; };
 		}
 		var setfn;
-		switch(mode){
-		case 'prepend':
-			setfn = function(node, s){setstr(node, s + getstr(node));};
-			break;
-		case 'self':
-		case 'contents':
-			setfn = function(node, s){setstr(node, s);};
-			break;
-		case 'append':
-			setfn = function(node, s){setstr(node, getstr(node) + s);};
-			break;
+		if(prepend){
+			setfn = function(node, s){ setstr( node, s + getstr( node ) );};
+		}else if(append){
+			setfn = function(node, s){ setstr( node, getstr( node ) + s );};
+		}else{
+			setfn = function(node, s){ setstr( node, s );};
 		}
 		return {attr: attr, nodes: target, set: setfn, sel: osel, quotefn: quotefn};
 	}
@@ -283,26 +294,28 @@ $p.core = function(sel, ctxt, plugins){
 		var sig = Sig + n + ':';
 		for(var i = 0; i &lt; target.nodes.length; i++){
 			// could check for overlapping targets here.
-			target.set(target.nodes[i], sig);
+			target.set( target.nodes[i], sig );
 		}
 	}
 
 	// read de loop data, and pass it to the inner rendering function
 	function loopfn(name, dselect, inner){
 		return function(ctxt){
-			var a = dselect(ctxt);
-			var oldvctxt = ctxt[name];
-			var vctxt = {items: a};
-			ctxt[name] = vctxt;
-			var n = (a &amp;&amp; a.length) || 0;
-			var strs = [];
+			var a = dselect(ctxt),
+				n = (a &amp;&amp; a.length) || 0,
+				loopCtxt={ json:ctxt.json },
+				strs = [];
+			loopCtxt[name] = { items:a };
+
 			for(var i = 0; i &lt; n; i++){
-				ctxt.pos = vctxt.pos = i;
-				ctxt.item = vctxt.item = a[i];
-				strs.push(inner(ctxt));
+				loopCtxt.data = ctxt.data;
+				loopCtxt.pos = loopCtxt[ name ].pos = i;
+				loopCtxt.item = loopCtxt[ name ].item = a[ i ];
+				strs.push( inner( loopCtxt ) );
 			}
-			ctxt[name] = oldvctxt;
+
 			return strs.join('');
+
 		};
 	}
 
@@ -406,7 +419,7 @@ $p.core = function(sel, ctxt, plugins){
 		var fns = [];
 		ans = ans || data &amp;&amp; getAutoNodes(dom, data);
 		if(data){
-			var j, jj, cspec, n;
+			var j, jj, cspec, n, target, nodes, itersel, node, inner;
 			while(ans.length &gt; 0){
 				cspec = ans[0].cspec;
 				n = ans[0].n;
@@ -416,12 +429,12 @@ $p.core = function(sel, ctxt, plugins){
 					setsig(target, fns.length);
 					fns[fns.length] = wrapquote(target.quotefn, dataselectfn(cspec.prop));
 				}else{
-					var itersel = dataselectfn(cspec.sel);
-					var target = gettarget(n, cspec, true);
-					var nodes = target.nodes;
+					itersel = dataselectfn(cspec.sel);
+					target = gettarget(n, cspec, true);
+					nodes = target.nodes;
 					for(j = 0, jj = nodes.length; j &lt; jj; j++){
-						var node = nodes[j];
-						var inner = compiler(node, false, data, ans);
+						node = nodes[j];
+						inner = compiler(node, false, data, ans);
 						fns[fns.length] = wrapquote(target.quotefn, loopfn(cspec.sel, itersel, inner));
 						target.nodes = [node];
 						setsig(target, fns.length - 1);
@@ -444,14 +457,21 @@ $p.core = function(sel, ctxt, plugins){
 			}
 		}
 		
-		var h = outerHTML(dom);
-		var parts = h.split(Sig);
-		var pfns = [];
+		var h = outerHTML( dom ),
+			checkStyle = new RegExp( 'style[0-9]+=&quot;?' + Sig ),
+			pfns = [];
+
+		// style attribute cannot be set using setAttribute
+		if( checkStyle.test( h ) ){
+			h = h.replace( checkStyle, 'style=&quot;' + Sig );
+		}
+
+		var parts = h.split( Sig ), p;
 		for(var i = 1; i &lt; parts.length; i++){
-			var p = parts[i];
+			p = parts[i];
 			// part is of the form &quot;fn-number:...&quot; as placed there by setsig.
 			pfns[i] = fns[parseInt(p, 10)];
-			parts[i] = p.slice(p.indexOf(':') + 1, p.length);
+			parts[i] = p.substring(p.indexOf(':')+1);
 		}
 		return concatenator(parts, pfns);
 	}
@@ -463,8 +483,10 @@ $p.plugins = {
 	// return a function waiting the data as argument
 	compile:function(directive, ctxt, template){
 		var rfn = this._compiler( ( template || this[0] ).cloneNode(true), directive, ctxt);
+		var json;
 		return function(data){
-			return rfn({data: data});
+			json = json || data;
+			return rfn({data: data, json:json});
 		};
 	},
 	//compile with the directive as argument</diff>
      <filename>libs/pure2.js</filename>
    </modified>
    <modified>
      <diff>@@ -4,15 +4,16 @@
 		&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;
 		&lt;title&gt;PURE Unobtrusive Rendering Engine for HTML - Version 2&lt;/title&gt;
 		&lt;style&gt;
-			.exampleList{padding:0;list-style-type:none;}
+			.exampleList{padding:0; list-style-type:none;}
 
-			h3{margin:1em 0 0;float:left;}
+			h3{margin:1em 0 .3em;float:left;}
 			a{color:#369;text-decoration:none;}
 			a:hover{background:#369;color:#FFF;}
 
 			.run, .debug{ display:block; float:left;margin:1.3em 0 0 .5em;padding:0 .5em;}
 
 			.template{clear:both;padding:1em;background:#DEF;margin:0 0  0 1em;}
+			
 			#examples{display:none;}
 		&lt;/style&gt;
 		&lt;script src=&quot;../libs/pure2.js&quot;&gt;&lt;/script&gt;
@@ -22,9 +23,11 @@
 
 		&lt;div id=&quot;chooseLib&quot; style=&quot;height:2em&quot;&gt;
 			Choose a library to run the examples:
+			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('domassistant');&quot; value=&quot;DomAssistant&quot; /&gt;
 			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('jQuery');&quot; value=&quot;jQuery&quot; /&gt;
-			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('mootools');&quot; value=&quot;mootools&quot; /&gt;
-			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('sizzle');&quot; value=&quot;sizzle&quot; /&gt;
+			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('mootools');&quot; value=&quot;Mootools&quot; /&gt;
+			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('prototype');&quot; value=&quot;Prototype&quot; /&gt;
+			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('sizzle');&quot; value=&quot;Sizzle&quot; /&gt;
 			&lt;input class=&quot;lib&quot; type=&quot;button&quot; onclick=&quot;loadLib('Sly');&quot; value=&quot;Sly&quot; /&gt;
 		&lt;/div&gt;
 	
@@ -35,7 +38,7 @@
 					&lt;h3&gt;Hello World&lt;/h3&gt;
 
 					&lt;div class=&quot;template&quot;&gt;
-						&lt;div class=&quot;who&quot; /&gt;
+						&lt;div class=&quot;who&quot;&gt;&lt;/div&gt;
 					&lt;/div&gt;
 
 					&lt;script&gt;
@@ -69,10 +72,10 @@
 					&lt;h3&gt;Auto Rendering with loops (+ directives)&lt;/h3&gt;
 					&lt;div class=&quot;template&quot;&gt;
 						&lt;div class=&quot;friends&quot;&gt;
-							The friends of &lt;a target=&quot;_blank&quot; class=&quot;who&quot;&gt;&lt;/a&gt; are
+							The friends of &lt;a target=&quot;_blank&quot; href=&quot;http://twitter.com/&quot; class=&quot;who&quot;&gt;&lt;/a&gt; are
 							&lt;ul&gt;
 								&lt;li class=&quot;friend&quot;&gt;
-									&lt;a target=&quot;_blank&quot; class=&quot;name twitter@href+&quot; href=&quot;http://twitter.com/&quot;&gt;&lt;/a&gt;
+									&lt;a target=&quot;_blank&quot; class=&quot;name twitter@title twitter@href+&quot; href=&quot;http://twitter.com/&quot;&gt;&lt;/a&gt;
 								&lt;/li&gt;
 							&lt;/ul&gt;
 						&lt;/div&gt;
@@ -83,25 +86,23 @@
 							template:'div.friends',
 							directive:{
 								'.who':'who2.name',
-								'.who[href]':'http://twitter/#{who2.twitter}'
+								'.who[title]':'See the tweets of #{who2.twitter}',
+								'.who[href]+':'who2.twitter'
 							},
 							data:{
 								friend:[
 									{
 										name:'Hughes', 
-										twitter:'hugheswaroquier',
-										knowledges:['erlang', 'js', 'css']
+										twitter:'hugheswaroquier'
 									},{
 										name:'Yves', 
-										twitter:'yveshiernaux',
-										knowledges:['js', 'css', 'HTML', 'buzz']
+										twitter:'yveshiernaux'
 									}
 								], 
 								who:'dono',
 								who2:{
 									name:'Mic', 
-									twitter:'tchvil',
-									knowledges:['js', 'css', 'HTML']
+									twitter:'tchvil'
 								}
 							}
 						};
@@ -125,6 +126,12 @@
 					     &lt;/tbody&gt;
 					   &lt;/table&gt;
 					&lt;/div&gt;
+					&lt;style&gt;
+						.playerList td{
+							padding:0 1em;
+							border:1px solid #999;
+						}
+					&lt;/style&gt;
 
 					&lt;script&gt;
 						var ex04 = {
@@ -175,16 +182,22 @@
 					     &lt;/tbody&gt;
 					   &lt;/table&gt;
 					&lt;/div&gt;
-
+					&lt;style&gt;
+						.partialTable td{
+							padding:0 1em;
+							border:1px solid #999;
+						}
+					&lt;/style&gt;
 					&lt;script&gt;
 						var ex05 = {
 							template:'table.partialTable',
 							data:{
 								cols:['name', 'food', 'legs'],
 								animals:[
-									{name:'cat', food:'mouse', legs:4},
-									{name:'mouse', food:'cheese', legs:4},
-									{name:'dog', food:'bones', legs:4}
+									{name:'bird', food:'seed', legs:2},
+									{name:'cat', food:'mouse, bird', legs:4},
+									{name:'dog', food:'bone', legs:4},
+									{name:'mouse', food:'cheese', legs:4}
 								]
 							},
 							directive1:{
@@ -244,6 +257,15 @@
 						  &lt;/table&gt;
 						&lt;/div&gt;
 					&lt;/div&gt;
+					&lt;style&gt;
+						.teamPlace table{
+							width:100%;
+						}
+						.scoreBoard td{
+							padding:0 1em;
+							border:1px solid #999;
+						}
+					&lt;/style&gt;
 
 					&lt;script&gt;
 						var ex06 = {
@@ -300,52 +322,51 @@
 
 				&lt;/li&gt;
 
-				&lt;li&gt;
+				&lt;li class=&quot;ex07&quot;&gt;
 					&lt;h3&gt;Recursion&lt;/h3&gt;
 					&lt;div class=&quot;template&quot;&gt;
-						&lt;div class=&quot;htmlDoc&quot;&gt;
-						    &lt;ul class=&quot;treeItem&quot;&gt;
-						        &lt;li&gt;
-						          &lt;a class=&quot;name&quot; href=&quot;#&quot;&gt;name&lt;/a&gt;
-						          &lt;div class=&quot;children&quot;&gt;&lt;/div&gt;
-						        &lt;/li&gt;
-						    &lt;/ul&gt;
-						&lt;/div&gt;
+					    &lt;ul class=&quot;treeItem&quot;&gt;
+					        &lt;li&gt;
+					          &lt;a class=&quot;name&quot; href=&quot;#&quot;&gt;name&lt;/a&gt;
+					          &lt;div class=&quot;children&quot;&gt;&lt;/div&gt;
+					        &lt;/li&gt;
+					    &lt;/ul&gt;
 					&lt;/div&gt;
-
 					&lt;script&gt;
-						var data4 = {
-							children: [{
-								name: 'Europe',
+						var ex07 = {
+							template:'ul.treeItem',
+							data:{
 								children: [{
-									name: 'Belgium',
+									name: 'Europe',
 									children: [{
-										name: 'Brussels'},{
-										name: 'Namur'},{
-										name: 'Antwerpen'}]},{
-									name: 'Germany'},{
-									name: 'UK'}]},{
-								name: 'America',
-								children: [{
-									name: 'US',
+										name: 'Belgium',
+										children: [{
+											name: 'Brussels'},{
+											name: 'Namur'},{
+											name: 'Antwerpen'}]},{
+										name: 'Germany'},{
+										name: 'UK'}]},{
+									name: 'America',
 									children: [{
-										name: 'Alabama'},{
-										name: 'Georgia'}]},{
-									name: 'Canada'},{
-									name: 'Argentina'}]},{
-								name: 'Asia'},{
-								name: 'Africa'},{
-								name: 'Antarctica'}
-							]
-						};
-
-						var directive4 = {
-							'li': {
-								'child &lt;- children': {
-									'a': 'child.name',
-									'a[onclick]':'alert(\'#{child.name}\');',
-									'div.children': function(ctxt){
-										return ctxt.child.item.children ? countries(ctxt.child.item):'';
+										name: 'US',
+										children: [{
+											name: 'Alabama'},{
+											name: 'Georgia'}]},{
+										name: 'Canada'},{
+										name: 'Argentina'}]},{
+									name: 'Asia'},{
+									name: 'Africa'},{
+									name: 'Antarctica'}
+								]
+							},
+							directive:{
+								'li': {
+									'child &lt;- children': {
+										'a': 'child.name',
+										'a[onclick]':'alert(\'#{child.name}\');',
+										'div.children': function(ctxt){
+											return ctxt.child.item.children ? countries(ctxt.child.item):'';
+										}
 									}
 								}
 							}</diff>
      <filename>test/testPage.html</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 function loadLib(lib){
-	document.getElementById('chooseLib').innerHTML += ' Loading' + lib;
-	loadScript(['../libs/'+lib+'.js', 'with'+lib+'.js']);
+	document.getElementById( 'chooseLib' ).innerHTML += ' Loading... ' + lib;
+	loadScript([ '../libs/' + lib + '.js', 'with_' + lib + '.js' ]);
 	var cnt = 0;
 	function loadScript(srcs){
 		if(srcs.length &gt; 0){
@@ -20,9 +20,9 @@ function loadLib(lib){
 		}
 	}
 	function done(){
-		document.getElementById('chooseLib').innerHTML = lib + ' loaded. You can now run the examples below.';
-		document.getElementById('examples').style.display = 'block';
-		var lis = $p('ul.exampleList li'),
+		document.getElementById( 'chooseLib' ).innerHTML = lib + ' loaded. You can now run the examples below.';
+		document.getElementById( 'examples' ).style.display = 'block';
+		var lis = $p( 'ul.exampleList li' ),
 			lii,
 			cn,
 			span;
@@ -35,7 +35,7 @@ function loadLib(lib){
 			var h = $p('h3', lii);
 			if(h[0]){
 				h = h[0];
-				span = document.createElement('SPAN');
+				span = document.createElement( 'SPAN' );
 				h.parentNode.insertBefore(span, h.nextSibling);
 				var cn = lis[i].className;
 				window[cn].id = cn;</diff>
      <filename>test/testPage.js</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/withJquery.js</filename>
    </removed>
    <removed>
      <filename>test/withMootools.js</filename>
    </removed>
    <removed>
      <filename>test/withSizzle.js</filename>
    </removed>
    <removed>
      <filename>test/withSly.js</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>4e5c4f35972ec1b950b8c3215b1131a9df11e3a6</id>
    </parent>
  </parents>
  <author>
    <name>mic</name>
    <email>mic@beebole.com</email>
  </author>
  <url>http://github.com/pure/pure/commit/26534c45225948a44beb7b80f4605b39024f956b</url>
  <id>26534c45225948a44beb7b80f4605b39024f956b</id>
  <committed-date>2009-06-25T15:58:42-07:00</committed-date>
  <authored-date>2009-06-25T15:58:42-07:00</authored-date>
  <message>add other libraries. style attr. code cleaning</message>
  <tree>3b39d2f9fa2acd2ccfa89272b920fc2262238a41</tree>
  <committer>
    <name>mic</name>
    <email>mic@beebole.com</email>
  </committer>
</commit>
