Permalink
Browse files

Start the plugin architecture. Only Examples 1-3 are converted

  • Loading branch information...
1 parent 3dd9501 commit 0d923005e043674ae8d5ee4261cf90acf95d582c mic committed Mar 14, 2009
Showing with 452 additions and 572 deletions.
  1. +2 −2 docs/allExamples.html
  2. +5 −25 docs/js/allExamples.js
  3. +19 −0 js/jqueryMin.js
  4. +426 −545 js/pure.js
@@ -4,8 +4,8 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>The Features of PURE Unobtrusive Rendering Engine for HTML</title>
<link href="css/white.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="../js/jquery.js"></script>
- <script type="text/javascript" src="../js/purePacked.js"></script>
+ <script type="text/javascript" src="../js/sizzle.js"></script>
+ <script type="text/javascript" src="../js/pure.js"></script>
<script type="text/javascript" src="js/allExamples.js"></script>
</head>
@@ -2,36 +2,17 @@
* E X A M P L E 1
* * * * * * * * * * * * * * * * * * * * * */
function render1(){
- $('div#hello').autoRender({ "who": "Mary" });}
-
- /* Note:
- All the notation below are possible with different results:
-
- a) as above. replacing the html by itself transformed with the data
- $('#hello').autoRender({ "who": "Mary" })
-
- b) replacing the target by the html transformed
- $('#hello').autoRender({ "who": "Mary" }, $('#target1'));
-
-
- c) Replacing the content of a target
- $('#target1').html( $p.autoRender($('#hello')[0], { "who": "Mary" }));
-
-
- d) same as c) but without js framework (jQuery)
- var target = document.getElementById('target1');
- var html = document.getElementById('hello');
- var data = { "who": "Mary" };
- target.innerHTML = $p.autoRender( html, data );
- */
+ $p({selector:'div#hello'}).render({data:{who:'Mary 2'}});
+} //render, either replacing the node or its innerHTML
/* * * * * * * * * * * * * * * * * * * * * *
* E X A M P L E 2
* * * * * * * * * * * * * * * * * * * * * */
function render2(){
var context = ["Alice Keasler", "Charles LeGrand", "Gary Bitemning", "Helen Moren"];
- $('#players1').autoRender(context);}
+ $p({selector:'#players1'}).render({data:context});}
+
/* * * * * * * * * * * * * * * * * * * * * *
* E X A M P L E 3
@@ -43,8 +24,7 @@ function render3(){
"name": "Beebole","url": "http://beebole.com"}, {
"name": "BeeBuzz", "url": "http://beebole.com/blog"}, {
"name": "PURE", "url": "http://beebole.com/pure"}]};
-
- $('#siteList').autoRender(context);}
+ $p({selector:'#siteList'}).render({data:context});}
/* Note:
to access the attributes of the root of the html use a directive as above for the id.
View
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 0d92300

Please sign in to comment.