encapsulation.html 962 B

1234567891011121314151617181920212223242526272829303132
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title></title>
  5. <meta charset="utf-8">
  6. </head>
  7. <body>
  8. <div id="test" sd-hola="hi | nodigits"></div>
  9. <script src="../dist/seed.js"></script>
  10. <script>
  11. var T = Seed.extend({
  12. directives: {
  13. hola: function (value) {
  14. this.el.innerHTML = value + '<span style="color:#f00"> this part is added by the directive</span>'
  15. }
  16. },
  17. filters: {
  18. nodigits: function (value) {
  19. return value.replace(/\d/g, '')
  20. }
  21. }
  22. })
  23. new T({
  24. el: '#test',
  25. data: {
  26. hi: 'ho43h132oh5o12345'
  27. }
  28. })
  29. // expected ouput: hohoho this part is added by the directive
  30. </script>
  31. </body>
  32. </html>