Sin descripción

24-with-start-indices.json 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {
  2. "name": "withStartIndices adds correct startIndex properties",
  3. "options": {"withStartIndices": true},
  4. "streaming": false,
  5. "html": "<!DOCTYPE html> <html> <title>The Title</title> <body class='foo'>Hello world <p></p></body> <!-- the comment --> </html> ",
  6. "expected": [
  7. {
  8. "startIndex": 0,
  9. "name": "!doctype",
  10. "data": "!DOCTYPE html",
  11. "type": "directive"
  12. },
  13. {
  14. "type": "text",
  15. "data": " "
  16. },
  17. {
  18. "startIndex": 16,
  19. "type": "tag",
  20. "name": "html",
  21. "attribs": {},
  22. "parent": null,
  23. "children": [
  24. {
  25. "startIndex": 22,
  26. "type": "text",
  27. "data": " "
  28. },
  29. {
  30. "startIndex": 23,
  31. "type": "tag",
  32. "name": "title",
  33. "attribs": {},
  34. "children": [
  35. {
  36. "startIndex": 30,
  37. "data": "The Title",
  38. "type": "text"
  39. }
  40. ]
  41. },
  42. {
  43. "startIndex": 47,
  44. "type": "text",
  45. "data": " "
  46. },
  47. {
  48. "startIndex": 48,
  49. "type": "tag",
  50. "name": "body",
  51. "attribs": {"class": "foo"},
  52. "children": [
  53. {
  54. "startIndex": 66,
  55. "data": "Hello world ",
  56. "type": "text"
  57. },
  58. {
  59. "startIndex": 78,
  60. "type": "tag",
  61. "name": "p",
  62. "attribs": {},
  63. "children": []
  64. }
  65. ]
  66. },
  67. {
  68. "startIndex": 92,
  69. "type": "text",
  70. "data": " "
  71. },
  72. {
  73. "startIndex": 93,
  74. "type": "comment",
  75. "data": " the comment "
  76. },
  77. {
  78. "startIndex": 113,
  79. "type": "text",
  80. "data": " "
  81. }
  82. ]
  83. }
  84. ]
  85. }