issue-49.js 1008 B

12345678910111213141516171819202122232425262728293031
  1. // https://github.com/isaacs/sax-js/issues/49
  2. require(__dirname).test
  3. ( { xml : "<xml><script>hello world</script></xml>"
  4. , expect :
  5. [ [ "opentag", { name: "xml", attributes: {}, isSelfClosing: false } ]
  6. , [ "opentag", { name: "script", attributes: {}, isSelfClosing: false } ]
  7. , [ "text", "hello world" ]
  8. , [ "closetag", "script" ]
  9. , [ "closetag", "xml" ]
  10. ]
  11. , strict : false
  12. , opt : { lowercasetags: true, noscript: true }
  13. }
  14. )
  15. require(__dirname).test
  16. ( { xml : "<xml><script><![CDATA[hello world]]></script></xml>"
  17. , expect :
  18. [ [ "opentag", { name: "xml", attributes: {}, isSelfClosing: false } ]
  19. , [ "opentag", { name: "script", attributes: {}, isSelfClosing: false } ]
  20. , [ "opencdata", undefined ]
  21. , [ "cdata", "hello world" ]
  22. , [ "closecdata", undefined ]
  23. , [ "closetag", "script" ]
  24. , [ "closetag", "xml" ]
  25. ]
  26. , strict : false
  27. , opt : { lowercasetags: true, noscript: true }
  28. }
  29. )