/sandbox/yui/each.php

https://github.com/nonano/yui3 · PHP · 65 lines · 57 code · 8 blank · 0 comment · 1 complexity · 85d87959edaeb527f0822d113a1e3286 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>YUI: Each</title>
  5. </head>
  6. <body class="yui-skin-sam">
  7. <div id="demo">
  8. <ul>
  9. <?php
  10. for ($i = 1; $i <= 30; $i++) {
  11. echo('<li id="item_'.$i.'">Item #'.$i.'</li>'."\n");
  12. }
  13. ?>
  14. </ul>
  15. </div>
  16. <script type="text/javascript" src="../../build/yui/yui-debug.js?bust=<?php echo(mktime()); ?>"></script>
  17. <script type="text/javascript" src="../../build/attribute/attribute-debug.js?bust=<?php echo(mktime()); ?>"></script>
  18. <script type="text/javascript" src="../../build/base/base-debug.js?bust=<?php echo(mktime()); ?>"></script>
  19. <script type="text/javascript" src="../../build/event/event-debug.js?bust=<?php echo(mktime()); ?>"></script>
  20. <script type="text/javascript" src="../../build/event-custom/event-custom-debug.js?bust=<?php echo(mktime()); ?>"></script>
  21. <script type="text/javascript" src="../../build/oop/oop-debug.js?bust=<?php echo(mktime()); ?>"></script>
  22. <script type="text/javascript" src="../../build/dom/dom-debug.js?bust=<?php echo(mktime()); ?>"></script>
  23. <script type="text/javascript" src="../../build/node/node-debug.js?bust=<?php echo(mktime()); ?>"></script>
  24. <script type="text/javascript">
  25. var yConfig = {
  26. base: '../../build/',
  27. allowRollup: false,
  28. logExclude: {
  29. event: true,
  30. base: true,
  31. attribute: true,
  32. augment: true
  33. },
  34. throwFail: true,
  35. debug: true
  36. };
  37. YUI(yConfig).use('node', function(Y) {
  38. var demo = Y.get('#demo');
  39. var lis = demo.getElementsByTagName('li');
  40. Y.log('collection length: ' + lis.length);
  41. Y.log('collection tagName: ' + lis.tagName);
  42. Y.log('collection alert: ' + lis.alert);
  43. Y.log('collection size: ' + lis.size());
  44. lis.each(function(item) {
  45. item.setStyle('border', '1px solid red');
  46. });
  47. var nlis = document.getElementsByTagName('li');
  48. Y.log('native collection length: ' + nlis.length);
  49. Y.log('native collection tagName: ' + nlis.tagName);
  50. Y.log('native collection alert: ' + nlis.alert);
  51. Y.log('native collection size: ' + nlis.size);
  52. Y.log('native collection test: ' + Y.Array.test(nlis));
  53. Y.log('native collection isObject and not function: ' + Y.Lang.isObject(nlis, true));
  54. });
  55. </script>
  56. </body>
  57. </html>