nokolexbor 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (486) hide show
  1. checksums.yaml +7 -0
  2. data/ext/nokolexbor/config.h +186 -0
  3. data/ext/nokolexbor/extconf.rb +131 -0
  4. data/ext/nokolexbor/libxml/HTMLparser.h +320 -0
  5. data/ext/nokolexbor/libxml/SAX2.h +173 -0
  6. data/ext/nokolexbor/libxml/chvalid.h +230 -0
  7. data/ext/nokolexbor/libxml/debugXML.h +217 -0
  8. data/ext/nokolexbor/libxml/dict.h +81 -0
  9. data/ext/nokolexbor/libxml/encoding.h +232 -0
  10. data/ext/nokolexbor/libxml/entities.h +153 -0
  11. data/ext/nokolexbor/libxml/globals.h +529 -0
  12. data/ext/nokolexbor/libxml/hash.h +236 -0
  13. data/ext/nokolexbor/libxml/list.h +137 -0
  14. data/ext/nokolexbor/libxml/parser.h +1264 -0
  15. data/ext/nokolexbor/libxml/parserInternals.h +641 -0
  16. data/ext/nokolexbor/libxml/pattern.h +100 -0
  17. data/ext/nokolexbor/libxml/threads.h +94 -0
  18. data/ext/nokolexbor/libxml/tree.h +1315 -0
  19. data/ext/nokolexbor/libxml/uri.h +94 -0
  20. data/ext/nokolexbor/libxml/valid.h +448 -0
  21. data/ext/nokolexbor/libxml/xmlIO.h +369 -0
  22. data/ext/nokolexbor/libxml/xmlautomata.h +146 -0
  23. data/ext/nokolexbor/libxml/xmlerror.h +919 -0
  24. data/ext/nokolexbor/libxml/xmlexports.h +79 -0
  25. data/ext/nokolexbor/libxml/xmlmemory.h +226 -0
  26. data/ext/nokolexbor/libxml/xmlregexp.h +222 -0
  27. data/ext/nokolexbor/libxml/xmlstring.h +140 -0
  28. data/ext/nokolexbor/libxml/xmlversion.h +526 -0
  29. data/ext/nokolexbor/libxml/xpath.h +575 -0
  30. data/ext/nokolexbor/libxml/xpathInternals.h +632 -0
  31. data/ext/nokolexbor/libxml/xpointer.h +137 -0
  32. data/ext/nokolexbor/libxml.h +76 -0
  33. data/ext/nokolexbor/memory.c +39 -0
  34. data/ext/nokolexbor/nl_document.c +51 -0
  35. data/ext/nokolexbor/nl_node.c +790 -0
  36. data/ext/nokolexbor/nl_node_set.c +368 -0
  37. data/ext/nokolexbor/nl_xpath_context.c +200 -0
  38. data/ext/nokolexbor/nokolexbor.c +63 -0
  39. data/ext/nokolexbor/nokolexbor.h +37 -0
  40. data/ext/nokolexbor/private/buf.h +70 -0
  41. data/ext/nokolexbor/private/dict.h +11 -0
  42. data/ext/nokolexbor/private/enc.h +17 -0
  43. data/ext/nokolexbor/private/error.h +21 -0
  44. data/ext/nokolexbor/private/globals.h +9 -0
  45. data/ext/nokolexbor/private/memory.h +9 -0
  46. data/ext/nokolexbor/private/parser.h +27 -0
  47. data/ext/nokolexbor/private/string.h +9 -0
  48. data/ext/nokolexbor/private/threads.h +50 -0
  49. data/ext/nokolexbor/private/tree.h +18 -0
  50. data/ext/nokolexbor/private/xpath.h +7 -0
  51. data/ext/nokolexbor/timsort.h +601 -0
  52. data/ext/nokolexbor/xml_SAX2.c +80 -0
  53. data/ext/nokolexbor/xml_buf.c +363 -0
  54. data/ext/nokolexbor/xml_chvalid.c +334 -0
  55. data/ext/nokolexbor/xml_dict.c +1264 -0
  56. data/ext/nokolexbor/xml_encoding.c +124 -0
  57. data/ext/nokolexbor/xml_error.c +134 -0
  58. data/ext/nokolexbor/xml_globals.c +1085 -0
  59. data/ext/nokolexbor/xml_hash.c +1141 -0
  60. data/ext/nokolexbor/xml_memory.c +203 -0
  61. data/ext/nokolexbor/xml_parser.c +127 -0
  62. data/ext/nokolexbor/xml_parserInternals.c +338 -0
  63. data/ext/nokolexbor/xml_pattern.c +2375 -0
  64. data/ext/nokolexbor/xml_string.c +1051 -0
  65. data/ext/nokolexbor/xml_threads.c +881 -0
  66. data/ext/nokolexbor/xml_tree.c +148 -0
  67. data/ext/nokolexbor/xml_xpath.c +14743 -0
  68. data/lib/nokolexbor/attribute.rb +18 -0
  69. data/lib/nokolexbor/document.rb +6 -0
  70. data/lib/nokolexbor/node.rb +264 -0
  71. data/lib/nokolexbor/node_set.rb +124 -0
  72. data/lib/nokolexbor/version.rb +5 -0
  73. data/lib/nokolexbor/xpath_context.rb +14 -0
  74. data/lib/nokolexbor.rb +17 -0
  75. data/patches/0001-lexbor-support-text-pseudo-element.patch +137 -0
  76. data/patches/0002-lexbor-match-id-class-case-sensitive.patch +22 -0
  77. data/patches/0003-lexbor-attach-template-content-to-self.patch +13 -0
  78. data/vendor/lexbor/CMakeLists.txt +331 -0
  79. data/vendor/lexbor/config.cmake +890 -0
  80. data/vendor/lexbor/feature.cmake +134 -0
  81. data/vendor/lexbor/source/lexbor/core/array.c +208 -0
  82. data/vendor/lexbor/source/lexbor/core/array.h +100 -0
  83. data/vendor/lexbor/source/lexbor/core/array_obj.c +216 -0
  84. data/vendor/lexbor/source/lexbor/core/array_obj.h +134 -0
  85. data/vendor/lexbor/source/lexbor/core/avl.c +442 -0
  86. data/vendor/lexbor/source/lexbor/core/avl.h +82 -0
  87. data/vendor/lexbor/source/lexbor/core/base.h +86 -0
  88. data/vendor/lexbor/source/lexbor/core/bst.c +468 -0
  89. data/vendor/lexbor/source/lexbor/core/bst.h +108 -0
  90. data/vendor/lexbor/source/lexbor/core/bst_map.c +238 -0
  91. data/vendor/lexbor/source/lexbor/core/bst_map.h +87 -0
  92. data/vendor/lexbor/source/lexbor/core/config.cmake +12 -0
  93. data/vendor/lexbor/source/lexbor/core/conv.c +203 -0
  94. data/vendor/lexbor/source/lexbor/core/conv.h +53 -0
  95. data/vendor/lexbor/source/lexbor/core/core.h +35 -0
  96. data/vendor/lexbor/source/lexbor/core/def.h +57 -0
  97. data/vendor/lexbor/source/lexbor/core/diyfp.c +153 -0
  98. data/vendor/lexbor/source/lexbor/core/diyfp.h +258 -0
  99. data/vendor/lexbor/source/lexbor/core/dobject.c +187 -0
  100. data/vendor/lexbor/source/lexbor/core/dobject.h +92 -0
  101. data/vendor/lexbor/source/lexbor/core/dtoa.c +404 -0
  102. data/vendor/lexbor/source/lexbor/core/dtoa.h +28 -0
  103. data/vendor/lexbor/source/lexbor/core/fs.h +60 -0
  104. data/vendor/lexbor/source/lexbor/core/hash.c +476 -0
  105. data/vendor/lexbor/source/lexbor/core/hash.h +218 -0
  106. data/vendor/lexbor/source/lexbor/core/in.c +267 -0
  107. data/vendor/lexbor/source/lexbor/core/in.h +172 -0
  108. data/vendor/lexbor/source/lexbor/core/lexbor.h +35 -0
  109. data/vendor/lexbor/source/lexbor/core/mem.c +228 -0
  110. data/vendor/lexbor/source/lexbor/core/mem.h +141 -0
  111. data/vendor/lexbor/source/lexbor/core/mraw.c +428 -0
  112. data/vendor/lexbor/source/lexbor/core/mraw.h +114 -0
  113. data/vendor/lexbor/source/lexbor/core/perf.h +45 -0
  114. data/vendor/lexbor/source/lexbor/core/plog.c +73 -0
  115. data/vendor/lexbor/source/lexbor/core/plog.h +102 -0
  116. data/vendor/lexbor/source/lexbor/core/print.c +168 -0
  117. data/vendor/lexbor/source/lexbor/core/print.h +39 -0
  118. data/vendor/lexbor/source/lexbor/core/sbst.h +59 -0
  119. data/vendor/lexbor/source/lexbor/core/serialize.c +27 -0
  120. data/vendor/lexbor/source/lexbor/core/serialize.h +32 -0
  121. data/vendor/lexbor/source/lexbor/core/shs.c +118 -0
  122. data/vendor/lexbor/source/lexbor/core/shs.h +82 -0
  123. data/vendor/lexbor/source/lexbor/core/str.c +617 -0
  124. data/vendor/lexbor/source/lexbor/core/str.h +247 -0
  125. data/vendor/lexbor/source/lexbor/core/str_res.h +369 -0
  126. data/vendor/lexbor/source/lexbor/core/strtod.c +326 -0
  127. data/vendor/lexbor/source/lexbor/core/strtod.h +28 -0
  128. data/vendor/lexbor/source/lexbor/core/types.h +39 -0
  129. data/vendor/lexbor/source/lexbor/core/utils.c +43 -0
  130. data/vendor/lexbor/source/lexbor/core/utils.h +36 -0
  131. data/vendor/lexbor/source/lexbor/css/base.h +44 -0
  132. data/vendor/lexbor/source/lexbor/css/config.cmake +2 -0
  133. data/vendor/lexbor/source/lexbor/css/css.h +25 -0
  134. data/vendor/lexbor/source/lexbor/css/log.c +336 -0
  135. data/vendor/lexbor/source/lexbor/css/log.h +103 -0
  136. data/vendor/lexbor/source/lexbor/css/node.h +29 -0
  137. data/vendor/lexbor/source/lexbor/css/parser.c +473 -0
  138. data/vendor/lexbor/source/lexbor/css/parser.h +368 -0
  139. data/vendor/lexbor/source/lexbor/css/selectors/base.h +48 -0
  140. data/vendor/lexbor/source/lexbor/css/selectors/pseudo.c +91 -0
  141. data/vendor/lexbor/source/lexbor/css/selectors/pseudo.h +66 -0
  142. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_const.h +109 -0
  143. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_res.h +302 -0
  144. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.c +279 -0
  145. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.h +85 -0
  146. data/vendor/lexbor/source/lexbor/css/selectors/selector.c +927 -0
  147. data/vendor/lexbor/source/lexbor/css/selectors/selector.h +200 -0
  148. data/vendor/lexbor/source/lexbor/css/selectors/selectors.c +340 -0
  149. data/vendor/lexbor/source/lexbor/css/selectors/selectors.h +137 -0
  150. data/vendor/lexbor/source/lexbor/css/selectors/state.c +1718 -0
  151. data/vendor/lexbor/source/lexbor/css/selectors/state.h +79 -0
  152. data/vendor/lexbor/source/lexbor/css/stylesheet.h +37 -0
  153. data/vendor/lexbor/source/lexbor/css/syntax/anb.c +443 -0
  154. data/vendor/lexbor/source/lexbor/css/syntax/anb.h +45 -0
  155. data/vendor/lexbor/source/lexbor/css/syntax/base.h +33 -0
  156. data/vendor/lexbor/source/lexbor/css/syntax/parser.c +9 -0
  157. data/vendor/lexbor/source/lexbor/css/syntax/parser.h +25 -0
  158. data/vendor/lexbor/source/lexbor/css/syntax/res.h +48 -0
  159. data/vendor/lexbor/source/lexbor/css/syntax/state.c +2603 -0
  160. data/vendor/lexbor/source/lexbor/css/syntax/state.h +140 -0
  161. data/vendor/lexbor/source/lexbor/css/syntax/state_res.h +273 -0
  162. data/vendor/lexbor/source/lexbor/css/syntax/syntax.c +67 -0
  163. data/vendor/lexbor/source/lexbor/css/syntax/token.c +618 -0
  164. data/vendor/lexbor/source/lexbor/css/syntax/token.h +298 -0
  165. data/vendor/lexbor/source/lexbor/css/syntax/token_res.h +68 -0
  166. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.c +30 -0
  167. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.h +58 -0
  168. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.c +278 -0
  169. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.h +121 -0
  170. data/vendor/lexbor/source/lexbor/dom/base.h +32 -0
  171. data/vendor/lexbor/source/lexbor/dom/collection.c +97 -0
  172. data/vendor/lexbor/source/lexbor/dom/collection.h +112 -0
  173. data/vendor/lexbor/source/lexbor/dom/config.cmake +3 -0
  174. data/vendor/lexbor/source/lexbor/dom/dom.h +29 -0
  175. data/vendor/lexbor/source/lexbor/dom/exception.c +18 -0
  176. data/vendor/lexbor/source/lexbor/dom/exception.h +73 -0
  177. data/vendor/lexbor/source/lexbor/dom/interface.c +110 -0
  178. data/vendor/lexbor/source/lexbor/dom/interface.h +88 -0
  179. data/vendor/lexbor/source/lexbor/dom/interfaces/attr.c +445 -0
  180. data/vendor/lexbor/source/lexbor/dom/interfaces/attr.h +152 -0
  181. data/vendor/lexbor/source/lexbor/dom/interfaces/attr_const.h +62 -0
  182. data/vendor/lexbor/source/lexbor/dom/interfaces/attr_res.h +143 -0
  183. data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.c +55 -0
  184. data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.h +38 -0
  185. data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.c +110 -0
  186. data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.h +51 -0
  187. data/vendor/lexbor/source/lexbor/dom/interfaces/comment.c +64 -0
  188. data/vendor/lexbor/source/lexbor/dom/interfaces/comment.h +42 -0
  189. data/vendor/lexbor/source/lexbor/dom/interfaces/document.c +536 -0
  190. data/vendor/lexbor/source/lexbor/dom/interfaces/document.h +243 -0
  191. data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.c +36 -0
  192. data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.h +36 -0
  193. data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.c +125 -0
  194. data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.h +108 -0
  195. data/vendor/lexbor/source/lexbor/dom/interfaces/element.c +1411 -0
  196. data/vendor/lexbor/source/lexbor/dom/interfaces/element.h +319 -0
  197. data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.c +32 -0
  198. data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.h +34 -0
  199. data/vendor/lexbor/source/lexbor/dom/interfaces/node.c +661 -0
  200. data/vendor/lexbor/source/lexbor/dom/interfaces/node.h +192 -0
  201. data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.c +87 -0
  202. data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.h +66 -0
  203. data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.c +36 -0
  204. data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.h +44 -0
  205. data/vendor/lexbor/source/lexbor/dom/interfaces/text.c +63 -0
  206. data/vendor/lexbor/source/lexbor/dom/interfaces/text.h +42 -0
  207. data/vendor/lexbor/source/lexbor/encoding/base.h +218 -0
  208. data/vendor/lexbor/source/lexbor/encoding/big5.c +42839 -0
  209. data/vendor/lexbor/source/lexbor/encoding/config.cmake +12 -0
  210. data/vendor/lexbor/source/lexbor/encoding/const.h +65 -0
  211. data/vendor/lexbor/source/lexbor/encoding/decode.c +3193 -0
  212. data/vendor/lexbor/source/lexbor/encoding/decode.h +370 -0
  213. data/vendor/lexbor/source/lexbor/encoding/encode.c +1931 -0
  214. data/vendor/lexbor/source/lexbor/encoding/encode.h +377 -0
  215. data/vendor/lexbor/source/lexbor/encoding/encoding.c +252 -0
  216. data/vendor/lexbor/source/lexbor/encoding/encoding.h +475 -0
  217. data/vendor/lexbor/source/lexbor/encoding/euc_kr.c +53883 -0
  218. data/vendor/lexbor/source/lexbor/encoding/gb18030.c +47905 -0
  219. data/vendor/lexbor/source/lexbor/encoding/iso_2022_jp_katakana.c +159 -0
  220. data/vendor/lexbor/source/lexbor/encoding/jis0208.c +22477 -0
  221. data/vendor/lexbor/source/lexbor/encoding/jis0212.c +15787 -0
  222. data/vendor/lexbor/source/lexbor/encoding/multi.h +53 -0
  223. data/vendor/lexbor/source/lexbor/encoding/range.c +71 -0
  224. data/vendor/lexbor/source/lexbor/encoding/range.h +34 -0
  225. data/vendor/lexbor/source/lexbor/encoding/res.c +222 -0
  226. data/vendor/lexbor/source/lexbor/encoding/res.h +34 -0
  227. data/vendor/lexbor/source/lexbor/encoding/single.c +13748 -0
  228. data/vendor/lexbor/source/lexbor/encoding/single.h +116 -0
  229. data/vendor/lexbor/source/lexbor/html/base.h +44 -0
  230. data/vendor/lexbor/source/lexbor/html/config.cmake +3 -0
  231. data/vendor/lexbor/source/lexbor/html/encoding.c +574 -0
  232. data/vendor/lexbor/source/lexbor/html/encoding.h +106 -0
  233. data/vendor/lexbor/source/lexbor/html/html.h +107 -0
  234. data/vendor/lexbor/source/lexbor/html/interface.c +165 -0
  235. data/vendor/lexbor/source/lexbor/html/interface.h +186 -0
  236. data/vendor/lexbor/source/lexbor/html/interface_res.h +4449 -0
  237. data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.c +36 -0
  238. data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.h +34 -0
  239. data/vendor/lexbor/source/lexbor/html/interfaces/area_element.c +36 -0
  240. data/vendor/lexbor/source/lexbor/html/interfaces/area_element.h +34 -0
  241. data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.c +36 -0
  242. data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.h +34 -0
  243. data/vendor/lexbor/source/lexbor/html/interfaces/base_element.c +36 -0
  244. data/vendor/lexbor/source/lexbor/html/interfaces/base_element.h +34 -0
  245. data/vendor/lexbor/source/lexbor/html/interfaces/body_element.c +36 -0
  246. data/vendor/lexbor/source/lexbor/html/interfaces/body_element.h +34 -0
  247. data/vendor/lexbor/source/lexbor/html/interfaces/br_element.c +36 -0
  248. data/vendor/lexbor/source/lexbor/html/interfaces/br_element.h +34 -0
  249. data/vendor/lexbor/source/lexbor/html/interfaces/button_element.c +36 -0
  250. data/vendor/lexbor/source/lexbor/html/interfaces/button_element.h +34 -0
  251. data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.c +36 -0
  252. data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.h +34 -0
  253. data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.c +36 -0
  254. data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.h +34 -0
  255. data/vendor/lexbor/source/lexbor/html/interfaces/data_element.c +36 -0
  256. data/vendor/lexbor/source/lexbor/html/interfaces/data_element.h +34 -0
  257. data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.c +36 -0
  258. data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.h +34 -0
  259. data/vendor/lexbor/source/lexbor/html/interfaces/details_element.c +36 -0
  260. data/vendor/lexbor/source/lexbor/html/interfaces/details_element.h +34 -0
  261. data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.c +36 -0
  262. data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.h +34 -0
  263. data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.c +36 -0
  264. data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.h +34 -0
  265. data/vendor/lexbor/source/lexbor/html/interfaces/div_element.c +36 -0
  266. data/vendor/lexbor/source/lexbor/html/interfaces/div_element.h +34 -0
  267. data/vendor/lexbor/source/lexbor/html/interfaces/document.c +444 -0
  268. data/vendor/lexbor/source/lexbor/html/interfaces/document.h +256 -0
  269. data/vendor/lexbor/source/lexbor/html/interfaces/element.c +64 -0
  270. data/vendor/lexbor/source/lexbor/html/interfaces/element.h +54 -0
  271. data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.c +36 -0
  272. data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.h +34 -0
  273. data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.c +36 -0
  274. data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.h +34 -0
  275. data/vendor/lexbor/source/lexbor/html/interfaces/font_element.c +36 -0
  276. data/vendor/lexbor/source/lexbor/html/interfaces/font_element.h +34 -0
  277. data/vendor/lexbor/source/lexbor/html/interfaces/form_element.c +36 -0
  278. data/vendor/lexbor/source/lexbor/html/interfaces/form_element.h +34 -0
  279. data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.c +36 -0
  280. data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.h +34 -0
  281. data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.c +36 -0
  282. data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.h +34 -0
  283. data/vendor/lexbor/source/lexbor/html/interfaces/head_element.c +36 -0
  284. data/vendor/lexbor/source/lexbor/html/interfaces/head_element.h +34 -0
  285. data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.c +36 -0
  286. data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.h +34 -0
  287. data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.c +36 -0
  288. data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.h +34 -0
  289. data/vendor/lexbor/source/lexbor/html/interfaces/html_element.c +36 -0
  290. data/vendor/lexbor/source/lexbor/html/interfaces/html_element.h +34 -0
  291. data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.c +36 -0
  292. data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.h +34 -0
  293. data/vendor/lexbor/source/lexbor/html/interfaces/image_element.c +36 -0
  294. data/vendor/lexbor/source/lexbor/html/interfaces/image_element.h +34 -0
  295. data/vendor/lexbor/source/lexbor/html/interfaces/input_element.c +36 -0
  296. data/vendor/lexbor/source/lexbor/html/interfaces/input_element.h +34 -0
  297. data/vendor/lexbor/source/lexbor/html/interfaces/label_element.c +36 -0
  298. data/vendor/lexbor/source/lexbor/html/interfaces/label_element.h +34 -0
  299. data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.c +36 -0
  300. data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.h +34 -0
  301. data/vendor/lexbor/source/lexbor/html/interfaces/li_element.c +36 -0
  302. data/vendor/lexbor/source/lexbor/html/interfaces/li_element.h +34 -0
  303. data/vendor/lexbor/source/lexbor/html/interfaces/link_element.c +36 -0
  304. data/vendor/lexbor/source/lexbor/html/interfaces/link_element.h +34 -0
  305. data/vendor/lexbor/source/lexbor/html/interfaces/map_element.c +36 -0
  306. data/vendor/lexbor/source/lexbor/html/interfaces/map_element.h +34 -0
  307. data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.c +36 -0
  308. data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.h +34 -0
  309. data/vendor/lexbor/source/lexbor/html/interfaces/media_element.c +36 -0
  310. data/vendor/lexbor/source/lexbor/html/interfaces/media_element.h +34 -0
  311. data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.c +36 -0
  312. data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.h +34 -0
  313. data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.c +36 -0
  314. data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.h +34 -0
  315. data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.c +36 -0
  316. data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.h +34 -0
  317. data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.c +36 -0
  318. data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.h +34 -0
  319. data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.c +36 -0
  320. data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.h +34 -0
  321. data/vendor/lexbor/source/lexbor/html/interfaces/object_element.c +36 -0
  322. data/vendor/lexbor/source/lexbor/html/interfaces/object_element.h +34 -0
  323. data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.c +36 -0
  324. data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.h +34 -0
  325. data/vendor/lexbor/source/lexbor/html/interfaces/option_element.c +36 -0
  326. data/vendor/lexbor/source/lexbor/html/interfaces/option_element.h +34 -0
  327. data/vendor/lexbor/source/lexbor/html/interfaces/output_element.c +36 -0
  328. data/vendor/lexbor/source/lexbor/html/interfaces/output_element.h +34 -0
  329. data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.c +36 -0
  330. data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.h +34 -0
  331. data/vendor/lexbor/source/lexbor/html/interfaces/param_element.c +36 -0
  332. data/vendor/lexbor/source/lexbor/html/interfaces/param_element.h +34 -0
  333. data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.c +36 -0
  334. data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.h +34 -0
  335. data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.c +36 -0
  336. data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.h +34 -0
  337. data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.c +36 -0
  338. data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.h +34 -0
  339. data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.c +36 -0
  340. data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.h +34 -0
  341. data/vendor/lexbor/source/lexbor/html/interfaces/script_element.c +36 -0
  342. data/vendor/lexbor/source/lexbor/html/interfaces/script_element.h +34 -0
  343. data/vendor/lexbor/source/lexbor/html/interfaces/select_element.c +36 -0
  344. data/vendor/lexbor/source/lexbor/html/interfaces/select_element.h +34 -0
  345. data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.c +36 -0
  346. data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.h +34 -0
  347. data/vendor/lexbor/source/lexbor/html/interfaces/source_element.c +36 -0
  348. data/vendor/lexbor/source/lexbor/html/interfaces/source_element.h +34 -0
  349. data/vendor/lexbor/source/lexbor/html/interfaces/span_element.c +36 -0
  350. data/vendor/lexbor/source/lexbor/html/interfaces/span_element.h +34 -0
  351. data/vendor/lexbor/source/lexbor/html/interfaces/style_element.c +36 -0
  352. data/vendor/lexbor/source/lexbor/html/interfaces/style_element.h +34 -0
  353. data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.c +36 -0
  354. data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.h +34 -0
  355. data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.c +36 -0
  356. data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.h +34 -0
  357. data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.c +36 -0
  358. data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.h +34 -0
  359. data/vendor/lexbor/source/lexbor/html/interfaces/table_element.c +36 -0
  360. data/vendor/lexbor/source/lexbor/html/interfaces/table_element.h +34 -0
  361. data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.c +36 -0
  362. data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.h +34 -0
  363. data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.c +36 -0
  364. data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.h +34 -0
  365. data/vendor/lexbor/source/lexbor/html/interfaces/template_element.c +46 -0
  366. data/vendor/lexbor/source/lexbor/html/interfaces/template_element.h +38 -0
  367. data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.c +36 -0
  368. data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.h +34 -0
  369. data/vendor/lexbor/source/lexbor/html/interfaces/time_element.c +36 -0
  370. data/vendor/lexbor/source/lexbor/html/interfaces/time_element.h +34 -0
  371. data/vendor/lexbor/source/lexbor/html/interfaces/title_element.c +133 -0
  372. data/vendor/lexbor/source/lexbor/html/interfaces/title_element.h +42 -0
  373. data/vendor/lexbor/source/lexbor/html/interfaces/track_element.c +36 -0
  374. data/vendor/lexbor/source/lexbor/html/interfaces/track_element.h +34 -0
  375. data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.c +36 -0
  376. data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.h +34 -0
  377. data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.c +36 -0
  378. data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.h +34 -0
  379. data/vendor/lexbor/source/lexbor/html/interfaces/video_element.c +36 -0
  380. data/vendor/lexbor/source/lexbor/html/interfaces/video_element.h +34 -0
  381. data/vendor/lexbor/source/lexbor/html/interfaces/window.c +36 -0
  382. data/vendor/lexbor/source/lexbor/html/interfaces/window.h +34 -0
  383. data/vendor/lexbor/source/lexbor/html/node.c +14 -0
  384. data/vendor/lexbor/source/lexbor/html/node.h +67 -0
  385. data/vendor/lexbor/source/lexbor/html/parser.c +469 -0
  386. data/vendor/lexbor/source/lexbor/html/parser.h +170 -0
  387. data/vendor/lexbor/source/lexbor/html/serialize.c +1510 -0
  388. data/vendor/lexbor/source/lexbor/html/serialize.h +93 -0
  389. data/vendor/lexbor/source/lexbor/html/tag.h +103 -0
  390. data/vendor/lexbor/source/lexbor/html/tag_res.h +2262 -0
  391. data/vendor/lexbor/source/lexbor/html/token.c +386 -0
  392. data/vendor/lexbor/source/lexbor/html/token.h +130 -0
  393. data/vendor/lexbor/source/lexbor/html/token_attr.c +44 -0
  394. data/vendor/lexbor/source/lexbor/html/token_attr.h +67 -0
  395. data/vendor/lexbor/source/lexbor/html/tokenizer/error.c +28 -0
  396. data/vendor/lexbor/source/lexbor/html/tokenizer/error.h +141 -0
  397. data/vendor/lexbor/source/lexbor/html/tokenizer/res.h +4956 -0
  398. data/vendor/lexbor/source/lexbor/html/tokenizer/state.c +2171 -0
  399. data/vendor/lexbor/source/lexbor/html/tokenizer/state.h +225 -0
  400. data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.c +489 -0
  401. data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.h +27 -0
  402. data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.c +1654 -0
  403. data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.h +27 -0
  404. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.c +303 -0
  405. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.h +32 -0
  406. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.c +311 -0
  407. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.h +32 -0
  408. data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.c +1209 -0
  409. data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.h +32 -0
  410. data/vendor/lexbor/source/lexbor/html/tokenizer.c +499 -0
  411. data/vendor/lexbor/source/lexbor/html/tokenizer.h +343 -0
  412. data/vendor/lexbor/source/lexbor/html/tree/active_formatting.c +241 -0
  413. data/vendor/lexbor/source/lexbor/html/tree/active_formatting.h +117 -0
  414. data/vendor/lexbor/source/lexbor/html/tree/error.c +26 -0
  415. data/vendor/lexbor/source/lexbor/html/tree/error.h +114 -0
  416. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_body.c +62 -0
  417. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_frameset.c +63 -0
  418. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_body.c +82 -0
  419. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_frameset.c +88 -0
  420. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_head.c +222 -0
  421. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_head.c +144 -0
  422. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_html.c +166 -0
  423. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/foreign_content.c +358 -0
  424. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_body.c +1974 -0
  425. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_caption.c +158 -0
  426. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_cell.c +187 -0
  427. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_column_group.c +194 -0
  428. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_frameset.c +149 -0
  429. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head.c +374 -0
  430. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head_noscript.c +121 -0
  431. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_row.c +211 -0
  432. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select.c +341 -0
  433. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select_in_table.c +115 -0
  434. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table.c +451 -0
  435. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_body.c +208 -0
  436. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_text.c +127 -0
  437. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_template.c +189 -0
  438. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/initial.c +411 -0
  439. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/text.c +61 -0
  440. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode.h +135 -0
  441. data/vendor/lexbor/source/lexbor/html/tree/open_elements.c +251 -0
  442. data/vendor/lexbor/source/lexbor/html/tree/open_elements.h +105 -0
  443. data/vendor/lexbor/source/lexbor/html/tree/template_insertion.c +10 -0
  444. data/vendor/lexbor/source/lexbor/html/tree/template_insertion.h +100 -0
  445. data/vendor/lexbor/source/lexbor/html/tree.c +1726 -0
  446. data/vendor/lexbor/source/lexbor/html/tree.h +431 -0
  447. data/vendor/lexbor/source/lexbor/html/tree_res.h +111 -0
  448. data/vendor/lexbor/source/lexbor/ns/base.h +32 -0
  449. data/vendor/lexbor/source/lexbor/ns/config.cmake +2 -0
  450. data/vendor/lexbor/source/lexbor/ns/const.h +37 -0
  451. data/vendor/lexbor/source/lexbor/ns/ns.c +154 -0
  452. data/vendor/lexbor/source/lexbor/ns/ns.h +66 -0
  453. data/vendor/lexbor/source/lexbor/ns/res.h +97 -0
  454. data/vendor/lexbor/source/lexbor/ports/posix/config.cmake +11 -0
  455. data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/fs.c +236 -0
  456. data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/memory.c +33 -0
  457. data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/perf.c +158 -0
  458. data/vendor/lexbor/source/lexbor/ports/windows_nt/config.cmake +18 -0
  459. data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/fs.c +239 -0
  460. data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/memory.c +33 -0
  461. data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/perf.c +81 -0
  462. data/vendor/lexbor/source/lexbor/selectors/base.h +30 -0
  463. data/vendor/lexbor/source/lexbor/selectors/config.cmake +2 -0
  464. data/vendor/lexbor/source/lexbor/selectors/selectors.c +1591 -0
  465. data/vendor/lexbor/source/lexbor/selectors/selectors.h +71 -0
  466. data/vendor/lexbor/source/lexbor/tag/base.h +32 -0
  467. data/vendor/lexbor/source/lexbor/tag/config.cmake +2 -0
  468. data/vendor/lexbor/source/lexbor/tag/const.h +225 -0
  469. data/vendor/lexbor/source/lexbor/tag/res.h +562 -0
  470. data/vendor/lexbor/source/lexbor/tag/tag.c +144 -0
  471. data/vendor/lexbor/source/lexbor/tag/tag.h +123 -0
  472. data/vendor/lexbor/source/lexbor/utils/base.h +32 -0
  473. data/vendor/lexbor/source/lexbor/utils/config.cmake +2 -0
  474. data/vendor/lexbor/source/lexbor/utils/http.c +534 -0
  475. data/vendor/lexbor/source/lexbor/utils/http.h +90 -0
  476. data/vendor/lexbor/source/lexbor/utils/utils.h +15 -0
  477. data/vendor/lexbor/source/lexbor/utils/warc.c +817 -0
  478. data/vendor/lexbor/source/lexbor/utils/warc.h +126 -0
  479. data/vendor/lexbor/utils/lexbor/css/selectors/pseudo.py +231 -0
  480. data/vendor/lexbor/utils/lexbor/css/selectors/tmp/const.h +21 -0
  481. data/vendor/lexbor/utils/lexbor/css/selectors/tmp/res.h +26 -0
  482. data/vendor/lexbor/utils/lexbor/css/syntax/definitions.py +49 -0
  483. data/vendor/lexbor/utils/lexbor/css/syntax/token_res.py +54 -0
  484. data/vendor/lexbor/utils/lexbor/css/syntax/tokenizer_code_map.py +36 -0
  485. data/vendor/lexbor/version +1 -0
  486. metadata +542 -0
@@ -0,0 +1,1974 @@
1
+ /*
2
+ * Copyright (C) 2018-2020 Alexander Borisov
3
+ *
4
+ * Author: Alexander Borisov <borisov@lexbor.com>
5
+ */
6
+
7
+ #define LEXBOR_TOKENIZER_CHARS_MAP
8
+ #include "lexbor/core/str_res.h"
9
+
10
+ #include "lexbor/html/tree/insertion_mode.h"
11
+ #include "lexbor/html/tree/open_elements.h"
12
+ #include "lexbor/html/tree/active_formatting.h"
13
+ #include "lexbor/html/interfaces/head_element.h"
14
+ #include "lexbor/html/tokenizer/state.h"
15
+ #include "lexbor/html/tokenizer/state_rcdata.h"
16
+
17
+
18
+ /*
19
+ * User case insertion mode.
20
+ *
21
+ * After "pre" and "listing" tag we need skip one newline in text tag.
22
+ * Since we have a stream of tokens,
23
+ * we can "look into the future" only in this way.
24
+ */
25
+ bool
26
+ lxb_html_tree_insertion_mode_in_body_skip_new_line(lxb_html_tree_t *tree,
27
+ lxb_html_token_t *token)
28
+ {
29
+ tree->mode = tree->original_mode;
30
+
31
+ if (token->tag_id != LXB_TAG__TEXT) {
32
+ return false;
33
+ }
34
+
35
+ tree->status = lxb_html_token_data_skip_one_newline_begin(token);
36
+ if (tree->status != LXB_STATUS_OK) {
37
+ return lxb_html_tree_process_abort(tree);
38
+ }
39
+
40
+ if (token->text_start == token->text_end) {
41
+ return true;
42
+ }
43
+
44
+ return false;
45
+ }
46
+
47
+ /*
48
+ * User case insertion mode.
49
+ *
50
+ * After "textarea" tag we need skip one newline in text tag.
51
+ */
52
+ bool
53
+ lxb_html_tree_insertion_mode_in_body_skip_new_line_textarea(lxb_html_tree_t *tree,
54
+ lxb_html_token_t *token)
55
+ {
56
+ tree->mode = tree->original_mode;
57
+
58
+ if (token->tag_id != LXB_TAG__TEXT) {
59
+ return false;
60
+ }
61
+
62
+ tree->status = lxb_html_token_data_skip_one_newline_begin(token);
63
+ if (tree->status != LXB_STATUS_OK) {
64
+ return lxb_html_tree_process_abort(tree);
65
+ }
66
+
67
+ if (token->text_start == token->text_end) {
68
+ return true;
69
+ }
70
+
71
+ return false;
72
+ }
73
+
74
+ /* Open */
75
+ lxb_inline bool
76
+ lxb_html_tree_insertion_mode_in_body_text(lxb_html_tree_t *tree,
77
+ lxb_html_token_t *token)
78
+ {
79
+ lexbor_str_t str;
80
+
81
+ if (token->null_count != 0) {
82
+ lxb_html_tree_parse_error(tree, token,
83
+ LXB_HTML_RULES_ERROR_NUCH);
84
+
85
+ tree->status = lxb_html_token_make_text_drop_null(token, &str,
86
+ tree->document->dom_document.text);
87
+ }
88
+ else {
89
+ tree->status = lxb_html_token_make_text(token, &str,
90
+ tree->document->dom_document.text);
91
+ }
92
+
93
+ if (tree->status != LXB_STATUS_OK) {
94
+ return lxb_html_tree_process_abort(tree);
95
+ }
96
+
97
+ /* Can be zero only if all NULL are gone */
98
+ if (str.length == 0) {
99
+ lexbor_str_destroy(&str, tree->document->dom_document.text, false);
100
+
101
+ return true;
102
+ }
103
+
104
+ lxb_html_tree_insertion_mode_in_body_text_append(tree, &str);
105
+ if (tree->status != LXB_STATUS_OK) {
106
+ return lxb_html_tree_process_abort(tree);
107
+ }
108
+
109
+ return true;
110
+ }
111
+
112
+ lxb_status_t
113
+ lxb_html_tree_insertion_mode_in_body_text_append(lxb_html_tree_t *tree,
114
+ lexbor_str_t *str)
115
+ {
116
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
117
+ if (tree->status != LXB_STATUS_OK) {
118
+ return tree->status;
119
+ }
120
+
121
+ if (tree->frameset_ok) {
122
+ const lxb_char_t *pos = str->data;
123
+ const lxb_char_t *end = str->data + str->length;
124
+
125
+ while (pos != end) {
126
+ if (lexbor_tokenizer_chars_map[*pos]
127
+ != LEXBOR_STR_RES_MAP_CHAR_WHITESPACE)
128
+ {
129
+ tree->frameset_ok = false;
130
+ break;
131
+ }
132
+
133
+ pos++;
134
+ }
135
+ }
136
+
137
+ tree->status = lxb_html_tree_insert_character_for_data(tree, str, NULL);
138
+ if (tree->status != LXB_STATUS_OK) {
139
+ return tree->status;
140
+ }
141
+
142
+ return LXB_STATUS_OK;
143
+ }
144
+
145
+ lxb_inline bool
146
+ lxb_html_tree_insertion_mode_in_body_comment(lxb_html_tree_t *tree,
147
+ lxb_html_token_t *token)
148
+ {
149
+ lxb_dom_comment_t *comment;
150
+
151
+ comment = lxb_html_tree_insert_comment(tree, token, NULL);
152
+ if (comment == NULL) {
153
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
154
+
155
+ return lxb_html_tree_process_abort(tree);
156
+ }
157
+
158
+ return true;
159
+ }
160
+
161
+ lxb_inline bool
162
+ lxb_html_tree_insertion_mode_in_body_doctype(lxb_html_tree_t *tree,
163
+ lxb_html_token_t *token)
164
+ {
165
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_DOTOINBOMO);
166
+
167
+ return true;
168
+ }
169
+
170
+ lxb_inline bool
171
+ lxb_html_tree_insertion_mode_in_body_html(lxb_html_tree_t *tree,
172
+ lxb_html_token_t *token)
173
+ {
174
+ lxb_dom_node_t *temp_node;
175
+ lxb_dom_element_t *html;
176
+
177
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNTO);
178
+
179
+ temp_node = lxb_html_tree_open_elements_find(tree, LXB_TAG_TEMPLATE,
180
+ LXB_NS_HTML, NULL);
181
+ if (temp_node != NULL) {
182
+ return true;
183
+ }
184
+
185
+ html = lxb_dom_interface_element(lxb_html_tree_open_elements_first(tree));
186
+
187
+ tree->status = lxb_html_tree_append_attributes(tree, html, token,
188
+ html->node.ns);
189
+ if (tree->status != LXB_HTML_STATUS_OK) {
190
+ return lxb_html_tree_process_abort(tree);
191
+ }
192
+
193
+ return true;
194
+ }
195
+
196
+ /*
197
+ * Start tag:
198
+ * "base", "basefont", "bgsound", "link", "meta", "noframes",
199
+ * "script", "style", "template", "title"
200
+ * End Tag:
201
+ * "template"
202
+ */
203
+ lxb_inline bool
204
+ lxb_html_tree_insertion_mode_in_body_blmnst(lxb_html_tree_t *tree,
205
+ lxb_html_token_t *token)
206
+ {
207
+ return lxb_html_tree_insertion_mode_in_head(tree, token);
208
+ }
209
+
210
+ lxb_inline bool
211
+ lxb_html_tree_insertion_mode_in_body_body(lxb_html_tree_t *tree,
212
+ lxb_html_token_t *token)
213
+ {
214
+ lxb_dom_node_t *node, *temp;
215
+ lxb_dom_element_t *body;
216
+
217
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNTO);
218
+
219
+ node = lxb_html_tree_open_elements_get(tree, 1);
220
+ if (node == NULL || node->local_name != LXB_TAG_BODY) {
221
+ return true;
222
+ }
223
+
224
+ temp = lxb_html_tree_open_elements_find_reverse(tree, LXB_TAG_TEMPLATE,
225
+ LXB_NS_HTML, NULL);
226
+ if (temp != NULL) {
227
+ return true;
228
+ }
229
+
230
+ tree->frameset_ok = false;
231
+
232
+ body = lxb_dom_interface_element(node);
233
+
234
+ tree->status = lxb_html_tree_append_attributes(tree, body, token, node->ns);
235
+ if (tree->status != LXB_HTML_STATUS_OK) {
236
+ return lxb_html_tree_process_abort(tree);
237
+ }
238
+
239
+ return true;
240
+ }
241
+
242
+ lxb_inline bool
243
+ lxb_html_tree_insertion_mode_in_body_frameset(lxb_html_tree_t *tree,
244
+ lxb_html_token_t *token)
245
+ {
246
+ lxb_dom_node_t *node;
247
+ lxb_html_element_t *element;
248
+
249
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNTO);
250
+
251
+ node = lxb_html_tree_open_elements_get(tree, 1);
252
+ if (node == NULL || node->local_name != LXB_TAG_BODY) {
253
+ return true;
254
+ }
255
+
256
+ if (tree->frameset_ok == false) {
257
+ return true;
258
+ }
259
+
260
+ lxb_html_tree_node_delete_deep(tree, node);
261
+
262
+ /* node is HTML */
263
+ node = lxb_html_tree_open_elements_get(tree, 0);
264
+ lxb_html_tree_open_elements_pop_until_node(tree, node, false);
265
+
266
+ element = lxb_html_tree_insert_html_element(tree, token);
267
+ if (element == NULL) {
268
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
269
+
270
+ return lxb_html_tree_process_abort(tree);
271
+ }
272
+
273
+ tree->mode = lxb_html_tree_insertion_mode_in_frameset;
274
+
275
+ return true;
276
+ }
277
+
278
+ lxb_inline bool
279
+ lxb_html_tree_insertion_mode_in_body_eof(lxb_html_tree_t *tree,
280
+ lxb_html_token_t *token)
281
+ {
282
+ if (lexbor_array_obj_length(tree->template_insertion_modes) != 0) {
283
+ return lxb_html_tree_insertion_mode_in_template(tree, token);
284
+ }
285
+
286
+ bool it_is = lxb_html_tree_check_scope_element(tree);
287
+ if (it_is == false) {
288
+ lxb_html_tree_parse_error(tree, token,
289
+ LXB_HTML_RULES_ERROR_BAENOPELISWR);
290
+ }
291
+
292
+ tree->status = lxb_html_tree_stop_parsing(tree);
293
+ if (tree->status != LXB_HTML_STATUS_OK) {
294
+ return lxb_html_tree_process_abort(tree);
295
+ }
296
+
297
+ return true;
298
+ }
299
+
300
+ lxb_inline bool
301
+ lxb_html_tree_insertion_mode_in_body_body_closed(lxb_html_tree_t *tree,
302
+ lxb_html_token_t *token)
303
+ {
304
+ lxb_dom_node_t *body_node;
305
+
306
+ body_node = lxb_html_tree_element_in_scope(tree, LXB_TAG_BODY, LXB_NS_HTML,
307
+ LXB_HTML_TAG_CATEGORY_SCOPE);
308
+ if (body_node == NULL) {
309
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_NOBOELINSC);
310
+
311
+ return true;
312
+ }
313
+
314
+ bool it_is = lxb_html_tree_check_scope_element(tree);
315
+ if (it_is == false) {
316
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_OPELISWR);
317
+ }
318
+
319
+ tree->mode = lxb_html_tree_insertion_mode_after_body;
320
+
321
+ return true;
322
+ }
323
+
324
+ lxb_inline bool
325
+ lxb_html_tree_insertion_mode_in_body_html_closed(lxb_html_tree_t *tree,
326
+ lxb_html_token_t *token)
327
+ {
328
+ lxb_dom_node_t *body_node;
329
+
330
+ body_node = lxb_html_tree_element_in_scope(tree, LXB_TAG_BODY, LXB_NS_HTML,
331
+ LXB_HTML_TAG_CATEGORY_SCOPE);
332
+ if (body_node == NULL) {
333
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_NOBOELINSC);
334
+
335
+ return true;
336
+ }
337
+
338
+ bool it_is = lxb_html_tree_check_scope_element(tree);
339
+ if (it_is == false) {
340
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_OPELISWR);
341
+ }
342
+
343
+ tree->mode = lxb_html_tree_insertion_mode_after_body;
344
+
345
+ return false;
346
+ }
347
+
348
+ /*
349
+ * "address", "article", "aside", "blockquote", "center", "details", "dialog",
350
+ * "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header",
351
+ * "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"
352
+ */
353
+ lxb_inline bool
354
+ lxb_html_tree_insertion_mode_in_body_abcdfhmnopsu(lxb_html_tree_t *tree,
355
+ lxb_html_token_t *token)
356
+ {
357
+ lxb_dom_node_t *body_node;
358
+ lxb_html_element_t *element;
359
+
360
+ body_node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
361
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
362
+ if (body_node != NULL) {
363
+ lxb_html_tree_close_p_element(tree, token);
364
+ }
365
+
366
+ element = lxb_html_tree_insert_html_element(tree, token);
367
+ if (element == NULL) {
368
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
369
+
370
+ return lxb_html_tree_process_abort(tree);
371
+ }
372
+
373
+ return true;
374
+ }
375
+
376
+ /*
377
+ * "h1", "h2", "h3", "h4", "h5", "h6"
378
+ */
379
+ lxb_inline bool
380
+ lxb_html_tree_insertion_mode_in_body_h123456(lxb_html_tree_t *tree,
381
+ lxb_html_token_t *token)
382
+ {
383
+ lxb_dom_node_t *node;
384
+ lxb_html_element_t *element;
385
+
386
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
387
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
388
+ if (node != NULL) {
389
+ lxb_html_tree_close_p_element(tree, token);
390
+ }
391
+
392
+ node = lxb_html_tree_current_node(tree);
393
+
394
+ switch (node->local_name) {
395
+ case LXB_TAG_H1:
396
+ case LXB_TAG_H2:
397
+ case LXB_TAG_H3:
398
+ case LXB_TAG_H4:
399
+ case LXB_TAG_H5:
400
+ case LXB_TAG_H6:
401
+ lxb_html_tree_parse_error(tree, token,
402
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
403
+
404
+ lxb_html_tree_open_elements_pop(tree);
405
+ break;
406
+
407
+ default:
408
+ break;
409
+ }
410
+
411
+ element = lxb_html_tree_insert_html_element(tree, token);
412
+ if (element == NULL) {
413
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
414
+
415
+ return lxb_html_tree_process_abort(tree);
416
+ }
417
+
418
+ return true;
419
+ }
420
+
421
+ /*
422
+ * "pre", "listing"
423
+ */
424
+ lxb_inline bool
425
+ lxb_html_tree_insertion_mode_in_body_pre_listing(lxb_html_tree_t *tree,
426
+ lxb_html_token_t *token)
427
+ {
428
+ lxb_dom_node_t *node;
429
+ lxb_html_element_t *element;
430
+
431
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
432
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
433
+ if (node != NULL) {
434
+ lxb_html_tree_close_p_element(tree, token);
435
+ }
436
+
437
+ element = lxb_html_tree_insert_html_element(tree, token);
438
+ if (element == NULL) {
439
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
440
+
441
+ return lxb_html_tree_process_abort(tree);
442
+ }
443
+
444
+ tree->original_mode = tree->mode;
445
+ tree->mode = lxb_html_tree_insertion_mode_in_body_skip_new_line;
446
+ tree->frameset_ok = false;
447
+
448
+ return true;
449
+ }
450
+
451
+ lxb_inline bool
452
+ lxb_html_tree_insertion_mode_in_body_form(lxb_html_tree_t *tree,
453
+ lxb_html_token_t *token)
454
+ {
455
+ lxb_dom_node_t *node, *temp;
456
+ lxb_html_element_t *element;
457
+
458
+ temp = lxb_html_tree_open_elements_find_reverse(tree, LXB_TAG_TEMPLATE,
459
+ LXB_NS_HTML, NULL);
460
+
461
+ if (tree->form != NULL && temp == NULL) {
462
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNTO);
463
+
464
+ return true;
465
+ }
466
+
467
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
468
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
469
+ if (node != NULL) {
470
+ lxb_html_tree_close_p_element(tree, token);
471
+ }
472
+
473
+ element = lxb_html_tree_insert_html_element(tree, token);
474
+ if (element == NULL) {
475
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
476
+
477
+ return lxb_html_tree_process_abort(tree);
478
+ }
479
+
480
+ if (temp == NULL) {
481
+ tree->form = lxb_html_interface_form(element);
482
+ }
483
+
484
+ return true;
485
+ }
486
+
487
+ lxb_inline bool
488
+ lxb_html_tree_insertion_mode_in_body_li(lxb_html_tree_t *tree,
489
+ lxb_html_token_t *token)
490
+ {
491
+ bool is_special;
492
+ lxb_dom_node_t *node;
493
+ lxb_html_element_t *element;
494
+
495
+ void **list = tree->open_elements->list;
496
+ size_t idx = tree->open_elements->length;
497
+
498
+ tree->frameset_ok = false;
499
+
500
+ while (idx != 0) {
501
+ idx--;
502
+
503
+ node = list[idx];
504
+
505
+ if (lxb_html_tree_node_is(node, LXB_TAG_LI)) {
506
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG_LI,
507
+ LXB_NS_HTML);
508
+
509
+ node = lxb_html_tree_current_node(tree);
510
+
511
+ if (lxb_html_tree_node_is(node, LXB_TAG_LI) == false) {
512
+ lxb_html_tree_parse_error(tree, token,
513
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
514
+ }
515
+
516
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, LXB_TAG_LI,
517
+ LXB_NS_HTML, true);
518
+ break;
519
+ }
520
+
521
+ is_special = lxb_html_tag_is_category(node->local_name, node->ns,
522
+ LXB_HTML_TAG_CATEGORY_SPECIAL);
523
+ if (is_special
524
+ && lxb_html_tree_node_is(node, LXB_TAG_ADDRESS) == false
525
+ && lxb_html_tree_node_is(node, LXB_TAG_DIV) == false
526
+ && lxb_html_tree_node_is(node, LXB_TAG_P) == false)
527
+ {
528
+ break;
529
+ }
530
+ }
531
+
532
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
533
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
534
+ if (node != NULL) {
535
+ lxb_html_tree_close_p_element(tree, token);
536
+ }
537
+
538
+ element = lxb_html_tree_insert_html_element(tree, token);
539
+ if (element == NULL) {
540
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
541
+
542
+ return lxb_html_tree_process_abort(tree);
543
+ }
544
+
545
+ return true;
546
+ }
547
+
548
+ /*
549
+ * "dd", "dt"
550
+ */
551
+ lxb_inline bool
552
+ lxb_html_tree_insertion_mode_in_body_dd_dt(lxb_html_tree_t *tree,
553
+ lxb_html_token_t *token)
554
+ {
555
+ bool is_special;
556
+ lxb_dom_node_t *node;
557
+ lxb_html_element_t *element;
558
+
559
+ void **list = tree->open_elements->list;
560
+ size_t idx = tree->open_elements->length;
561
+
562
+ tree->frameset_ok = false;
563
+
564
+ while (idx != 0) {
565
+ idx--;
566
+
567
+ node = list[idx];
568
+
569
+ if (lxb_html_tree_node_is(node, LXB_TAG_DD)) {
570
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG_DD,
571
+ LXB_NS_HTML);
572
+
573
+ node = lxb_html_tree_current_node(tree);
574
+
575
+ if (lxb_html_tree_node_is(node, LXB_TAG_DD) == false) {
576
+ lxb_html_tree_parse_error(tree, token,
577
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
578
+ }
579
+
580
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, LXB_TAG_DD,
581
+ LXB_NS_HTML, true);
582
+ break;
583
+ }
584
+
585
+ if (lxb_html_tree_node_is(node, LXB_TAG_DT)) {
586
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG_DT,
587
+ LXB_NS_HTML);
588
+
589
+ node = lxb_html_tree_current_node(tree);
590
+
591
+ if (lxb_html_tree_node_is(node, LXB_TAG_DT) == false) {
592
+ lxb_html_tree_parse_error(tree, token,
593
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
594
+ }
595
+
596
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, LXB_TAG_DT,
597
+ LXB_NS_HTML, true);
598
+ break;
599
+ }
600
+
601
+ is_special = lxb_html_tag_is_category(node->local_name, node->ns,
602
+ LXB_HTML_TAG_CATEGORY_SPECIAL);
603
+ if (is_special
604
+ && lxb_html_tree_node_is(node, LXB_TAG_ADDRESS) == false
605
+ && lxb_html_tree_node_is(node, LXB_TAG_DIV) == false
606
+ && lxb_html_tree_node_is(node, LXB_TAG_P) == false)
607
+ {
608
+ break;
609
+ }
610
+ }
611
+
612
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
613
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
614
+ if (node != NULL) {
615
+ lxb_html_tree_close_p_element(tree, token);
616
+ }
617
+
618
+ element = lxb_html_tree_insert_html_element(tree, token);
619
+ if (element == NULL) {
620
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
621
+
622
+ return lxb_html_tree_process_abort(tree);
623
+ }
624
+
625
+ return true;
626
+ }
627
+
628
+ lxb_inline bool
629
+ lxb_html_tree_insertion_mode_in_body_plaintext(lxb_html_tree_t *tree,
630
+ lxb_html_token_t *token)
631
+ {
632
+ lxb_dom_node_t *node;
633
+ lxb_html_element_t *element;
634
+
635
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
636
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
637
+ if (node != NULL) {
638
+ lxb_html_tree_close_p_element(tree, token);
639
+ }
640
+
641
+ element = lxb_html_tree_insert_html_element(tree, token);
642
+ if (element == NULL) {
643
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
644
+
645
+ return lxb_html_tree_process_abort(tree);
646
+ }
647
+
648
+ lxb_html_tokenizer_state_set(tree->tkz_ref,
649
+ lxb_html_tokenizer_state_plaintext_before);
650
+
651
+ return true;
652
+ }
653
+
654
+ lxb_inline bool
655
+ lxb_html_tree_insertion_mode_in_body_button(lxb_html_tree_t *tree,
656
+ lxb_html_token_t *token)
657
+ {
658
+ lxb_dom_node_t *node;
659
+ lxb_html_element_t *element;
660
+
661
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_BUTTON, LXB_NS_HTML,
662
+ LXB_HTML_TAG_CATEGORY_SCOPE);
663
+ if (node != NULL) {
664
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNTO);
665
+
666
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
667
+ LXB_NS__UNDEF);
668
+
669
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, LXB_TAG_BUTTON,
670
+ LXB_NS_HTML, true);
671
+ }
672
+
673
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
674
+ if (tree->status != LXB_STATUS_OK) {
675
+ return lxb_html_tree_process_abort(tree);
676
+ }
677
+
678
+ element = lxb_html_tree_insert_html_element(tree, token);
679
+ if (element == NULL) {
680
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
681
+
682
+ return lxb_html_tree_process_abort(tree);
683
+ }
684
+
685
+ tree->frameset_ok = false;
686
+
687
+ return true;
688
+ }
689
+
690
+ /*
691
+ * "address", "article", "aside", "blockquote", "button", "center", "details",
692
+ * "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
693
+ * "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section",
694
+ * "summary", "ul"
695
+ */
696
+ lxb_inline bool
697
+ lxb_html_tree_insertion_mode_in_body_abcdfhlmnopsu_closed(lxb_html_tree_t *tree,
698
+ lxb_html_token_t *token)
699
+ {
700
+ lxb_dom_node_t *node;
701
+
702
+ node = lxb_html_tree_element_in_scope(tree, token->tag_id,
703
+ LXB_NS_HTML, LXB_HTML_TAG_CATEGORY_SCOPE);
704
+ if (node == NULL) {
705
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNCLTO);
706
+
707
+ return true;
708
+ }
709
+
710
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
711
+ LXB_NS__UNDEF);
712
+
713
+ node = lxb_html_tree_current_node(tree);
714
+
715
+ if (lxb_html_tree_node_is(node, token->tag_id) == false) {
716
+ lxb_html_tree_parse_error(tree, token,
717
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
718
+ }
719
+
720
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, token->tag_id,
721
+ LXB_NS_HTML, true);
722
+
723
+ return true;
724
+ }
725
+
726
+ lxb_inline bool
727
+ lxb_html_tree_insertion_mode_in_body_form_closed(lxb_html_tree_t *tree,
728
+ lxb_html_token_t *token)
729
+ {
730
+ lxb_dom_node_t *node, *current;
731
+
732
+ node = lxb_html_tree_open_elements_find_reverse(tree, LXB_TAG_TEMPLATE,
733
+ LXB_NS_HTML, NULL);
734
+ if (node == NULL) {
735
+ node = lxb_dom_interface_node(tree->form);
736
+
737
+ tree->form = NULL;
738
+
739
+ if (node == NULL) {
740
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNCLTO);
741
+
742
+ return true;
743
+ }
744
+
745
+ node = lxb_html_tree_element_in_scope_by_node(tree, node,
746
+ LXB_HTML_TAG_CATEGORY_SCOPE);
747
+ if (node == NULL) {
748
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNCLTO);
749
+
750
+ return true;
751
+ }
752
+
753
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
754
+ LXB_NS__UNDEF);
755
+
756
+ current = lxb_html_tree_current_node(tree);
757
+
758
+ if (current != node) {
759
+ lxb_html_tree_parse_error(tree, token,
760
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
761
+ }
762
+
763
+ lxb_html_tree_open_elements_remove_by_node(tree, node);
764
+
765
+ return true;
766
+ }
767
+
768
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_FORM, LXB_NS_HTML,
769
+ LXB_HTML_TAG_CATEGORY_SCOPE);
770
+ if (node == NULL) {
771
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNCLTO);
772
+
773
+ return true;
774
+ }
775
+
776
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
777
+ LXB_NS__UNDEF);
778
+
779
+ node = lxb_html_tree_current_node(tree);
780
+
781
+ if (lxb_html_tree_node_is(node, LXB_TAG_FORM) == false) {
782
+ lxb_html_tree_parse_error(tree, token,
783
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
784
+ }
785
+
786
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, LXB_TAG_FORM,
787
+ LXB_NS_HTML, true);
788
+
789
+ return true;
790
+ }
791
+
792
+ lxb_inline bool
793
+ lxb_html_tree_insertion_mode_in_body_p_closed(lxb_html_tree_t *tree,
794
+ lxb_html_token_t *token)
795
+ {
796
+ lxb_dom_node_t *node;
797
+
798
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
799
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
800
+ if (node == NULL) {
801
+ lxb_html_token_t fake_token = {0};
802
+ lxb_html_element_t *element;
803
+
804
+ lxb_html_tree_parse_error(tree, token,
805
+ LXB_HTML_RULES_ERROR_UNCLTO);
806
+
807
+ fake_token.tag_id = LXB_TAG_P;
808
+
809
+ element = lxb_html_tree_insert_html_element(tree, &fake_token);
810
+ if (element == NULL) {
811
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
812
+
813
+ return lxb_html_tree_process_abort(tree);
814
+ }
815
+ }
816
+
817
+ lxb_html_tree_close_p_element(tree, token);
818
+
819
+ return true;
820
+ }
821
+
822
+ lxb_inline bool
823
+ lxb_html_tree_insertion_mode_in_body_li_closed(lxb_html_tree_t *tree,
824
+ lxb_html_token_t *token)
825
+ {
826
+ lxb_dom_node_t *node;
827
+
828
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_LI, LXB_NS_HTML,
829
+ LXB_HTML_TAG_CATEGORY_SCOPE_LIST_ITEM);
830
+ if (node == NULL) {
831
+ lxb_html_tree_parse_error(tree, token,
832
+ LXB_HTML_RULES_ERROR_UNCLTO);
833
+ return true;
834
+ }
835
+
836
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG_LI, LXB_NS_HTML);
837
+
838
+ node = lxb_html_tree_current_node(tree);
839
+
840
+ if (lxb_html_tree_node_is(node, LXB_TAG_LI) == false) {
841
+ lxb_html_tree_parse_error(tree, token,
842
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
843
+ }
844
+
845
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, LXB_TAG_LI, LXB_NS_HTML,
846
+ true);
847
+
848
+ return true;
849
+ }
850
+
851
+ /*
852
+ * "dd", "dt"
853
+ */
854
+ lxb_inline bool
855
+ lxb_html_tree_insertion_mode_in_body_dd_dt_closed(lxb_html_tree_t *tree,
856
+ lxb_html_token_t *token)
857
+ {
858
+ lxb_dom_node_t *node;
859
+
860
+ node = lxb_html_tree_element_in_scope(tree, token->tag_id, LXB_NS_HTML,
861
+ LXB_HTML_TAG_CATEGORY_SCOPE);
862
+ if (node == NULL) {
863
+ lxb_html_tree_parse_error(tree, token,
864
+ LXB_HTML_RULES_ERROR_UNCLTO);
865
+ return true;
866
+ }
867
+
868
+ lxb_html_tree_generate_implied_end_tags(tree, token->tag_id, LXB_NS_HTML);
869
+
870
+ node = lxb_html_tree_current_node(tree);
871
+
872
+ if (lxb_html_tree_node_is(node, token->tag_id) == false) {
873
+ lxb_html_tree_parse_error(tree, token,
874
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
875
+ }
876
+
877
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, token->tag_id,
878
+ LXB_NS_HTML, true);
879
+
880
+ return true;
881
+ }
882
+
883
+ /*
884
+ * "h1", "h2", "h3", "h4", "h5", "h6"
885
+ */
886
+ lxb_inline bool
887
+ lxb_html_tree_insertion_mode_in_body_h123456_closed(lxb_html_tree_t *tree,
888
+ lxb_html_token_t *token)
889
+ {
890
+ lxb_dom_node_t *node;
891
+
892
+ node = lxb_html_tree_element_in_scope_h123456(tree);
893
+ if (node == NULL) {
894
+ lxb_html_tree_parse_error(tree, token,
895
+ LXB_HTML_RULES_ERROR_UNCLTO);
896
+ return true;
897
+ }
898
+
899
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
900
+ LXB_NS__UNDEF);
901
+
902
+ node = lxb_html_tree_current_node(tree);
903
+
904
+ if (lxb_html_tree_node_is(node, token->tag_id) == false) {
905
+ lxb_html_tree_parse_error(tree, token,
906
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
907
+ }
908
+
909
+ lxb_html_tree_open_elements_pop_until_h123456(tree);
910
+
911
+ return true;
912
+ }
913
+
914
+ lxb_inline bool
915
+ lxb_html_tree_insertion_mode_in_body_a(lxb_html_tree_t *tree,
916
+ lxb_html_token_t *token)
917
+ {
918
+ lxb_dom_node_t *node;
919
+ lxb_html_element_t *element;
920
+
921
+ node = lxb_html_tree_active_formatting_between_last_marker(tree,
922
+ token->tag_id,
923
+ NULL);
924
+ if (node != NULL) {
925
+ /* bool is; */
926
+
927
+ lxb_html_tree_parse_error(tree, token,
928
+ LXB_HTML_RULES_ERROR_UNELINACFOST);
929
+
930
+ lxb_html_tree_adoption_agency_algorithm(tree, token,
931
+ &tree->status);
932
+ if (tree->status != LXB_STATUS_OK) {
933
+ return lxb_html_tree_process_abort(tree);
934
+ }
935
+
936
+ /*
937
+ if (is) {
938
+ return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
939
+ token);
940
+ }
941
+ */
942
+
943
+ lxb_html_tree_active_formatting_remove_by_node(tree, node);
944
+ lxb_html_tree_open_elements_remove_by_node(tree, node);
945
+ }
946
+
947
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
948
+ if (tree->status != LXB_STATUS_OK) {
949
+ return lxb_html_tree_process_abort(tree);
950
+ }
951
+
952
+ element = lxb_html_tree_insert_html_element(tree, token);
953
+ if (element == NULL) {
954
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
955
+
956
+ return lxb_html_tree_process_abort(tree);
957
+ }
958
+
959
+ node = lxb_dom_interface_node(element);
960
+
961
+ lxb_html_tree_active_formatting_push_with_check_dupl(tree, node);
962
+
963
+ return true;
964
+ }
965
+
966
+ /*
967
+ * "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong",
968
+ * "tt", "u"
969
+ */
970
+ lxb_inline bool
971
+ lxb_html_tree_insertion_mode_in_body_bcefistu(lxb_html_tree_t *tree,
972
+ lxb_html_token_t *token)
973
+ {
974
+ lxb_dom_node_t *node;
975
+ lxb_html_element_t *element;
976
+
977
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
978
+ if (tree->status != LXB_STATUS_OK) {
979
+ return lxb_html_tree_process_abort(tree);
980
+ }
981
+
982
+ element = lxb_html_tree_insert_html_element(tree, token);
983
+ if (element == NULL) {
984
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
985
+
986
+ return lxb_html_tree_process_abort(tree);
987
+ }
988
+
989
+ node = lxb_dom_interface_node(element);
990
+
991
+ lxb_html_tree_active_formatting_push_with_check_dupl(tree, node);
992
+
993
+ return true;
994
+ }
995
+
996
+ lxb_inline bool
997
+ lxb_html_tree_insertion_mode_in_body_nobr(lxb_html_tree_t *tree,
998
+ lxb_html_token_t *token)
999
+ {
1000
+ lxb_dom_node_t *node;
1001
+ lxb_html_element_t *element;
1002
+
1003
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1004
+ if (tree->status != LXB_STATUS_OK) {
1005
+ return lxb_html_tree_process_abort(tree);
1006
+ }
1007
+
1008
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_NOBR, LXB_NS_HTML,
1009
+ LXB_HTML_TAG_CATEGORY_SCOPE);
1010
+ if (node != NULL) {
1011
+ /* bool is; */
1012
+
1013
+ lxb_html_tree_parse_error(tree, token,
1014
+ LXB_HTML_RULES_ERROR_UNELINSC);
1015
+
1016
+ lxb_html_tree_adoption_agency_algorithm(tree, token, &tree->status);
1017
+ if (tree->status != LXB_STATUS_OK) {
1018
+ return lxb_html_tree_process_abort(tree);
1019
+ }
1020
+ /*
1021
+ if (is) {
1022
+ return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
1023
+ token);
1024
+ }
1025
+ */
1026
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1027
+ if (tree->status != LXB_STATUS_OK) {
1028
+ return lxb_html_tree_process_abort(tree);
1029
+ }
1030
+ }
1031
+
1032
+ element = lxb_html_tree_insert_html_element(tree, token);
1033
+ if (element == NULL) {
1034
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1035
+
1036
+ return lxb_html_tree_process_abort(tree);
1037
+ }
1038
+
1039
+ node = lxb_dom_interface_node(element);
1040
+
1041
+ lxb_html_tree_active_formatting_push_with_check_dupl(tree, node);
1042
+
1043
+ return true;
1044
+ }
1045
+
1046
+ /*
1047
+ * "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike",
1048
+ * "strong", "tt", "u"
1049
+ */
1050
+ lxb_inline bool
1051
+ lxb_html_tree_insertion_mode_in_body_abcefinstu_closed(lxb_html_tree_t *tree,
1052
+ lxb_html_token_t *token)
1053
+ {
1054
+ /* bool is; */
1055
+
1056
+ lxb_html_tree_adoption_agency_algorithm(tree, token, &tree->status);
1057
+ if (tree->status != LXB_STATUS_OK) {
1058
+ return lxb_html_tree_process_abort(tree);
1059
+ }
1060
+
1061
+ /*
1062
+ if (is) {
1063
+ return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
1064
+ token);
1065
+ }
1066
+ */
1067
+
1068
+ return true;
1069
+ }
1070
+
1071
+ /*
1072
+ * "applet", "marquee", "object"
1073
+ */
1074
+ lxb_inline bool
1075
+ lxb_html_tree_insertion_mode_in_body_amo(lxb_html_tree_t *tree,
1076
+ lxb_html_token_t *token)
1077
+ {
1078
+ lxb_html_element_t *element;
1079
+
1080
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1081
+ if (tree->status != LXB_STATUS_OK) {
1082
+ return lxb_html_tree_process_abort(tree);
1083
+ }
1084
+
1085
+ element = lxb_html_tree_insert_html_element(tree, token);
1086
+ if (element == NULL) {
1087
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1088
+
1089
+ return lxb_html_tree_process_abort(tree);
1090
+ }
1091
+
1092
+ tree->status = lxb_html_tree_active_formatting_push_marker(tree);
1093
+ if (tree->status != LXB_STATUS_OK) {
1094
+ return lxb_html_tree_process_abort(tree);
1095
+ }
1096
+
1097
+ tree->frameset_ok = false;
1098
+
1099
+ return true;
1100
+ }
1101
+
1102
+ /*
1103
+ * "applet", "marquee", "object"
1104
+ */
1105
+ lxb_inline bool
1106
+ lxb_html_tree_insertion_mode_in_body_amo_closed(lxb_html_tree_t *tree,
1107
+ lxb_html_token_t *token)
1108
+ {
1109
+ lxb_dom_node_t *node;
1110
+
1111
+ node = lxb_html_tree_element_in_scope(tree, token->tag_id, LXB_NS_HTML,
1112
+ LXB_HTML_TAG_CATEGORY_SCOPE);
1113
+ if (node == NULL) {
1114
+ lxb_html_tree_parse_error(tree, token,
1115
+ LXB_HTML_RULES_ERROR_UNCLTO);
1116
+ return true;
1117
+ }
1118
+
1119
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
1120
+ LXB_NS__UNDEF);
1121
+
1122
+ node = lxb_html_tree_current_node(tree);
1123
+
1124
+ if (lxb_html_tree_node_is(node, token->tag_id) == false) {
1125
+ lxb_html_tree_parse_error(tree, token,
1126
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
1127
+ }
1128
+
1129
+ lxb_html_tree_open_elements_pop_until_tag_id(tree, token->tag_id,
1130
+ LXB_NS_HTML, true);
1131
+
1132
+ lxb_html_tree_active_formatting_up_to_last_marker(tree);
1133
+
1134
+ return true;
1135
+ }
1136
+
1137
+ lxb_inline bool
1138
+ lxb_html_tree_insertion_mode_in_body_table(lxb_html_tree_t *tree,
1139
+ lxb_html_token_t *token)
1140
+ {
1141
+ lxb_dom_node_t *node;
1142
+ lxb_html_element_t *element;
1143
+
1144
+ if (lxb_dom_interface_document(tree->document)->compat_mode
1145
+ != LXB_DOM_DOCUMENT_CMODE_QUIRKS)
1146
+ {
1147
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
1148
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
1149
+ if (node != NULL) {
1150
+ lxb_html_tree_close_p_element(tree, token);
1151
+ }
1152
+ }
1153
+
1154
+ element = lxb_html_tree_insert_html_element(tree, token);
1155
+ if (element == NULL) {
1156
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1157
+
1158
+ return lxb_html_tree_process_abort(tree);
1159
+ }
1160
+
1161
+ tree->frameset_ok = false;
1162
+ tree->mode = lxb_html_tree_insertion_mode_in_table;
1163
+
1164
+ return true;
1165
+ }
1166
+
1167
+ /*
1168
+ * "area", "br", "embed", "img", "keygen", "wbr"
1169
+ */
1170
+ lxb_inline bool
1171
+ lxb_html_tree_insertion_mode_in_body_abeikw(lxb_html_tree_t *tree,
1172
+ lxb_html_token_t *token)
1173
+ {
1174
+ lxb_html_element_t *element;
1175
+
1176
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1177
+ if (tree->status != LXB_STATUS_OK) {
1178
+ return lxb_html_tree_process_abort(tree);
1179
+ }
1180
+
1181
+ element = lxb_html_tree_insert_html_element(tree, token);
1182
+ if (element == NULL) {
1183
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1184
+
1185
+ return lxb_html_tree_process_abort(tree);
1186
+ }
1187
+
1188
+ lxb_html_tree_open_elements_pop(tree);
1189
+ lxb_html_tree_acknowledge_token_self_closing(tree, token);
1190
+
1191
+ tree->frameset_ok = false;
1192
+
1193
+ return true;
1194
+ }
1195
+
1196
+ lxb_inline bool
1197
+ lxb_html_tree_insertion_mode_in_body_br_closed(lxb_html_tree_t *tree,
1198
+ lxb_html_token_t *token)
1199
+ {
1200
+ token->type ^= (token->type & LXB_HTML_TOKEN_TYPE_CLOSE);
1201
+ token->attr_first = NULL;
1202
+ token->attr_last = NULL;
1203
+
1204
+ return lxb_html_tree_insertion_mode_in_body_abeikw(tree, token);
1205
+ }
1206
+
1207
+ lxb_inline bool
1208
+ lxb_html_tree_insertion_mode_in_body_input(lxb_html_tree_t *tree,
1209
+ lxb_html_token_t *token)
1210
+ {
1211
+ lxb_dom_attr_t *attr;
1212
+ lxb_html_element_t *element;
1213
+
1214
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1215
+ if (tree->status != LXB_STATUS_OK) {
1216
+ return lxb_html_tree_process_abort(tree);
1217
+ }
1218
+
1219
+ element = lxb_html_tree_insert_html_element(tree, token);
1220
+ if (element == NULL) {
1221
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1222
+
1223
+ return lxb_html_tree_process_abort(tree);
1224
+ }
1225
+
1226
+ lxb_html_tree_open_elements_pop(tree);
1227
+ lxb_html_tree_acknowledge_token_self_closing(tree, token);
1228
+
1229
+ attr = lxb_dom_element_attr_is_exist(lxb_dom_interface_element(element),
1230
+ (lxb_char_t *) "type", 4);
1231
+ if (attr != NULL) {
1232
+ if (attr->value == NULL || attr->value->length != 6
1233
+ || lexbor_str_data_cmp(attr->value->data, (lxb_char_t *) "hidden") == false)
1234
+ {
1235
+ tree->frameset_ok = false;
1236
+ }
1237
+ }
1238
+ else {
1239
+ tree->frameset_ok = false;
1240
+ }
1241
+
1242
+ return true;
1243
+ }
1244
+
1245
+ /*
1246
+ * "param", "source", "track"
1247
+ */
1248
+ lxb_inline bool
1249
+ lxb_html_tree_insertion_mode_in_body_pst(lxb_html_tree_t *tree,
1250
+ lxb_html_token_t *token)
1251
+ {
1252
+ lxb_html_element_t *element;
1253
+
1254
+ element = lxb_html_tree_insert_html_element(tree, token);
1255
+ if (element == NULL) {
1256
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1257
+
1258
+ return lxb_html_tree_process_abort(tree);
1259
+ }
1260
+
1261
+ lxb_html_tree_open_elements_pop(tree);
1262
+ lxb_html_tree_acknowledge_token_self_closing(tree, token);
1263
+
1264
+ return true;
1265
+ }
1266
+
1267
+ lxb_inline bool
1268
+ lxb_html_tree_insertion_mode_in_body_hr(lxb_html_tree_t *tree,
1269
+ lxb_html_token_t *token)
1270
+ {
1271
+ lxb_dom_node_t *node;
1272
+ lxb_html_element_t *element;
1273
+
1274
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
1275
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
1276
+ if (node != NULL) {
1277
+ lxb_html_tree_close_p_element(tree, token);
1278
+ }
1279
+
1280
+ element = lxb_html_tree_insert_html_element(tree, token);
1281
+ if (element == NULL) {
1282
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1283
+
1284
+ return lxb_html_tree_process_abort(tree);
1285
+ }
1286
+
1287
+ lxb_html_tree_open_elements_pop(tree);
1288
+ lxb_html_tree_acknowledge_token_self_closing(tree, token);
1289
+
1290
+ tree->frameset_ok = false;
1291
+
1292
+ return true;
1293
+ }
1294
+
1295
+ lxb_inline bool
1296
+ lxb_html_tree_insertion_mode_in_body_image(lxb_html_tree_t *tree,
1297
+ lxb_html_token_t *token)
1298
+ {
1299
+ lxb_html_tree_parse_error(tree, token, LXB_HTML_RULES_ERROR_UNTO);
1300
+
1301
+ token->tag_id = LXB_TAG_IMG;
1302
+
1303
+ return false;
1304
+ }
1305
+
1306
+ lxb_inline bool
1307
+ lxb_html_tree_insertion_mode_in_body_textarea(lxb_html_tree_t *tree,
1308
+ lxb_html_token_t *token)
1309
+ {
1310
+ lxb_html_element_t *element;
1311
+
1312
+ element = lxb_html_tree_insert_html_element(tree, token);
1313
+ if (element == NULL) {
1314
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1315
+
1316
+ return lxb_html_tree_process_abort(tree);
1317
+ }
1318
+
1319
+ lxb_html_tokenizer_tmp_tag_id_set(tree->tkz_ref, LXB_TAG_TEXTAREA);
1320
+ lxb_html_tokenizer_state_set(tree->tkz_ref,
1321
+ lxb_html_tokenizer_state_rcdata_before);
1322
+
1323
+ tree->original_mode = tree->mode;
1324
+
1325
+ tree->frameset_ok = false;
1326
+
1327
+ tree->original_mode = tree->mode;
1328
+ tree->mode = lxb_html_tree_insertion_mode_in_body_skip_new_line_textarea;
1329
+
1330
+ return true;
1331
+ }
1332
+
1333
+ lxb_inline bool
1334
+ lxb_html_tree_insertion_mode_in_body_xmp(lxb_html_tree_t *tree,
1335
+ lxb_html_token_t *token)
1336
+ {
1337
+ lxb_dom_node_t *node;
1338
+ lxb_html_element_t *element;
1339
+
1340
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_P, LXB_NS_HTML,
1341
+ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON);
1342
+ if (node != NULL) {
1343
+ lxb_html_tree_close_p_element(tree, token);
1344
+ }
1345
+
1346
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1347
+ if (tree->status != LXB_STATUS_OK) {
1348
+ return lxb_html_tree_process_abort(tree);
1349
+ }
1350
+
1351
+ tree->frameset_ok = false;
1352
+
1353
+ element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1354
+ if (element == NULL) {
1355
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1356
+
1357
+ return lxb_html_tree_process_abort(tree);
1358
+ }
1359
+
1360
+ return true;
1361
+ }
1362
+
1363
+ lxb_inline bool
1364
+ lxb_html_tree_insertion_mode_in_body_iframe(lxb_html_tree_t *tree,
1365
+ lxb_html_token_t *token)
1366
+ {
1367
+ lxb_html_element_t *element;
1368
+
1369
+ tree->frameset_ok = false;
1370
+
1371
+ element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1372
+ if (element == NULL) {
1373
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1374
+
1375
+ return lxb_html_tree_process_abort(tree);
1376
+ }
1377
+
1378
+ return true;
1379
+ }
1380
+
1381
+ lxb_inline bool
1382
+ lxb_html_tree_insertion_mode_in_body_noembed(lxb_html_tree_t *tree,
1383
+ lxb_html_token_t *token)
1384
+ {
1385
+ lxb_html_element_t *element;
1386
+
1387
+ element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1388
+ if (element == NULL) {
1389
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1390
+
1391
+ return lxb_html_tree_process_abort(tree);
1392
+ }
1393
+
1394
+ return true;
1395
+ }
1396
+
1397
+ lxb_inline bool
1398
+ lxb_html_tree_insertion_mode_in_body_select(lxb_html_tree_t *tree,
1399
+ lxb_html_token_t *token)
1400
+ {
1401
+ lxb_html_element_t *element;
1402
+
1403
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1404
+ if (tree->status != LXB_STATUS_OK) {
1405
+ return lxb_html_tree_process_abort(tree);
1406
+ }
1407
+
1408
+ element = lxb_html_tree_insert_html_element(tree, token);
1409
+ if (element == NULL) {
1410
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1411
+
1412
+ return lxb_html_tree_process_abort(tree);
1413
+ }
1414
+
1415
+ tree->frameset_ok = false;
1416
+
1417
+ if (tree->mode == lxb_html_tree_insertion_mode_in_table
1418
+ || tree->mode == lxb_html_tree_insertion_mode_in_caption
1419
+ || tree->mode == lxb_html_tree_insertion_mode_in_table_body
1420
+ || tree->mode == lxb_html_tree_insertion_mode_in_row
1421
+ || tree->mode == lxb_html_tree_insertion_mode_in_cell)
1422
+ {
1423
+ tree->mode = lxb_html_tree_insertion_mode_in_select_in_table;
1424
+ }
1425
+ else {
1426
+ tree->mode = lxb_html_tree_insertion_mode_in_select;
1427
+ }
1428
+
1429
+ return true;
1430
+ }
1431
+
1432
+ /*
1433
+ * "optgroup", "option"
1434
+ */
1435
+ lxb_inline bool
1436
+ lxb_html_tree_insertion_mode_in_body_optopt(lxb_html_tree_t *tree,
1437
+ lxb_html_token_t *token)
1438
+ {
1439
+ lxb_dom_node_t *node;
1440
+ lxb_html_element_t *element;
1441
+
1442
+ node = lxb_html_tree_current_node(tree);
1443
+ if (lxb_html_tree_node_is(node, LXB_TAG_OPTION)) {
1444
+ lxb_html_tree_open_elements_pop(tree);
1445
+ }
1446
+
1447
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1448
+ if (tree->status != LXB_STATUS_OK) {
1449
+ return lxb_html_tree_process_abort(tree);
1450
+ }
1451
+
1452
+ element = lxb_html_tree_insert_html_element(tree, token);
1453
+ if (element == NULL) {
1454
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1455
+
1456
+ return lxb_html_tree_process_abort(tree);
1457
+ }
1458
+
1459
+ return true;
1460
+ }
1461
+
1462
+ /*
1463
+ * "rb", "rtc"
1464
+ */
1465
+ lxb_inline bool
1466
+ lxb_html_tree_insertion_mode_in_body_rbrtc(lxb_html_tree_t *tree,
1467
+ lxb_html_token_t *token)
1468
+ {
1469
+ lxb_dom_node_t *node;
1470
+ lxb_html_element_t *element;
1471
+
1472
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_RUBY, LXB_NS_HTML,
1473
+ LXB_HTML_TAG_CATEGORY_SCOPE);
1474
+ if (node != NULL) {
1475
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG__UNDEF,
1476
+ LXB_NS__UNDEF);
1477
+ }
1478
+
1479
+ node = lxb_html_tree_current_node(tree);
1480
+ if (lxb_html_tree_node_is(node, LXB_TAG_RUBY) == false) {
1481
+ lxb_html_tree_parse_error(tree, token,
1482
+ LXB_HTML_RULES_ERROR_MIELINOPELST);
1483
+ }
1484
+
1485
+ element = lxb_html_tree_insert_html_element(tree, token);
1486
+ if (element == NULL) {
1487
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1488
+
1489
+ return lxb_html_tree_process_abort(tree);
1490
+ }
1491
+
1492
+ return true;
1493
+ }
1494
+
1495
+ /*
1496
+ * "rp", "rt"
1497
+ */
1498
+ lxb_inline bool
1499
+ lxb_html_tree_insertion_mode_in_body_rprt(lxb_html_tree_t *tree,
1500
+ lxb_html_token_t *token)
1501
+ {
1502
+ lxb_dom_node_t *node;
1503
+ lxb_html_element_t *element;
1504
+
1505
+ node = lxb_html_tree_element_in_scope(tree, LXB_TAG_RUBY, LXB_NS_HTML,
1506
+ LXB_HTML_TAG_CATEGORY_SCOPE);
1507
+ if (node != NULL) {
1508
+ lxb_html_tree_generate_implied_end_tags(tree, LXB_TAG_RTC,
1509
+ LXB_NS_HTML);
1510
+ }
1511
+
1512
+ node = lxb_html_tree_current_node(tree);
1513
+
1514
+ if (lxb_html_tree_node_is(node, LXB_TAG_RTC) == false
1515
+ || lxb_html_tree_node_is(node, LXB_TAG_RUBY) == false)
1516
+ {
1517
+ lxb_html_tree_parse_error(tree, token,
1518
+ LXB_HTML_RULES_ERROR_MIELINOPELST);
1519
+ }
1520
+
1521
+ element = lxb_html_tree_insert_html_element(tree, token);
1522
+ if (element == NULL) {
1523
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1524
+
1525
+ return lxb_html_tree_process_abort(tree);
1526
+ }
1527
+
1528
+ return true;
1529
+ }
1530
+
1531
+ lxb_inline bool
1532
+ lxb_html_tree_insertion_mode_in_body_math(lxb_html_tree_t *tree,
1533
+ lxb_html_token_t *token)
1534
+ {
1535
+ lxb_html_element_t *element;
1536
+
1537
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1538
+ if (tree->status != LXB_STATUS_OK) {
1539
+ return lxb_html_tree_process_abort(tree);
1540
+ }
1541
+
1542
+ tree->before_append_attr = lxb_html_tree_adjust_attributes_mathml;
1543
+
1544
+ element = lxb_html_tree_insert_foreign_element(tree, token, LXB_NS_MATH);
1545
+ if (element == NULL) {
1546
+ tree->before_append_attr = NULL;
1547
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1548
+
1549
+ return lxb_html_tree_process_abort(tree);
1550
+ }
1551
+
1552
+ tree->before_append_attr = NULL;
1553
+
1554
+ if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE_SELF) {
1555
+ lxb_html_tree_open_elements_pop(tree);
1556
+ lxb_html_tree_acknowledge_token_self_closing(tree, token);
1557
+ }
1558
+
1559
+ return true;
1560
+ }
1561
+
1562
+ lxb_inline bool
1563
+ lxb_html_tree_insertion_mode_in_body_svg(lxb_html_tree_t *tree,
1564
+ lxb_html_token_t *token)
1565
+ {
1566
+ lxb_html_element_t *element;
1567
+
1568
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1569
+ if (tree->status != LXB_STATUS_OK) {
1570
+ return lxb_html_tree_process_abort(tree);
1571
+ }
1572
+
1573
+ tree->before_append_attr = lxb_html_tree_adjust_attributes_svg;
1574
+
1575
+ element = lxb_html_tree_insert_foreign_element(tree, token, LXB_NS_SVG);
1576
+ if (element == NULL) {
1577
+ tree->before_append_attr = NULL;
1578
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1579
+
1580
+ return lxb_html_tree_process_abort(tree);
1581
+ }
1582
+
1583
+ tree->before_append_attr = NULL;
1584
+
1585
+ if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE_SELF) {
1586
+ lxb_html_tree_open_elements_pop(tree);
1587
+ lxb_html_tree_acknowledge_token_self_closing(tree, token);
1588
+ }
1589
+
1590
+ return true;
1591
+ }
1592
+
1593
+ /*
1594
+ * "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th",
1595
+ * "thead", "tr"
1596
+ */
1597
+ lxb_inline bool
1598
+ lxb_html_tree_insertion_mode_in_body_cfht(lxb_html_tree_t *tree,
1599
+ lxb_html_token_t *token)
1600
+ {
1601
+ lxb_html_tree_parse_error(tree, token,
1602
+ LXB_HTML_RULES_ERROR_UNTO);
1603
+
1604
+ return true;
1605
+ }
1606
+
1607
+ lxb_inline bool
1608
+ lxb_html_tree_insertion_mode_in_body_anything_else(lxb_html_tree_t *tree,
1609
+ lxb_html_token_t *token)
1610
+ {
1611
+ lxb_html_element_t *element;
1612
+
1613
+ tree->status = lxb_html_tree_active_formatting_reconstruct_elements(tree);
1614
+ if (tree->status != LXB_STATUS_OK) {
1615
+ return lxb_html_tree_process_abort(tree);
1616
+ }
1617
+
1618
+ element = lxb_html_tree_insert_html_element(tree, token);
1619
+ if (element == NULL) {
1620
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1621
+
1622
+ return lxb_html_tree_process_abort(tree);
1623
+ }
1624
+
1625
+ return true;
1626
+ }
1627
+
1628
+ lxb_inline bool
1629
+ lxb_html_tree_insertion_mode_in_body_noscript(lxb_html_tree_t *tree,
1630
+ lxb_html_token_t *token)
1631
+ {
1632
+ if (tree->document->dom_document.scripting == false) {
1633
+ return lxb_html_tree_insertion_mode_in_body_anything_else(tree, token);
1634
+ }
1635
+
1636
+ lxb_html_element_t *element;
1637
+
1638
+ element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1639
+ if (element == NULL) {
1640
+ tree->status = LXB_STATUS_ERROR_MEMORY_ALLOCATION;
1641
+
1642
+ return lxb_html_tree_process_abort(tree);
1643
+ }
1644
+
1645
+ return true;
1646
+ }
1647
+
1648
+ lxb_inline bool
1649
+ lxb_html_tree_insertion_mode_in_body_anything_else_closed(lxb_html_tree_t *tree,
1650
+ lxb_html_token_t *token)
1651
+ {
1652
+ bool is;
1653
+ lxb_dom_node_t **list = (lxb_dom_node_t **) tree->open_elements->list;
1654
+ size_t len = tree->open_elements->length;
1655
+
1656
+ while (len != 0) {
1657
+ len--;
1658
+
1659
+ if (lxb_html_tree_node_is(list[len], token->tag_id)) {
1660
+ lxb_html_tree_generate_implied_end_tags(tree, token->tag_id,
1661
+ LXB_NS_HTML);
1662
+
1663
+ if (list[len] != lxb_html_tree_current_node(tree)) {
1664
+ lxb_html_tree_parse_error(tree, token,
1665
+ LXB_HTML_RULES_ERROR_UNELINOPELST);
1666
+ }
1667
+
1668
+ lxb_html_tree_open_elements_pop_until_node(tree, list[len], true);
1669
+
1670
+ return true;
1671
+ }
1672
+
1673
+ is = lxb_html_tag_is_category(list[len]->local_name, list[len]->ns,
1674
+ LXB_HTML_TAG_CATEGORY_SPECIAL);
1675
+ if (is) {
1676
+ lxb_html_tree_parse_error(tree, token,
1677
+ LXB_HTML_RULES_ERROR_UNCLTO);
1678
+ return true;
1679
+ }
1680
+ }
1681
+
1682
+ return true;
1683
+ }
1684
+
1685
+
1686
+ bool
1687
+ lxb_html_tree_insertion_mode_in_body(lxb_html_tree_t *tree,
1688
+ lxb_html_token_t *token)
1689
+ {
1690
+ if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE) {
1691
+ switch (token->tag_id) {
1692
+ case LXB_TAG_TEMPLATE:
1693
+ return lxb_html_tree_insertion_mode_in_body_blmnst(tree, token);
1694
+
1695
+ case LXB_TAG_BODY:
1696
+ return lxb_html_tree_insertion_mode_in_body_body_closed(tree,
1697
+ token);
1698
+ case LXB_TAG_HTML:
1699
+ return lxb_html_tree_insertion_mode_in_body_html_closed(tree,
1700
+ token);
1701
+ case LXB_TAG_ADDRESS:
1702
+ case LXB_TAG_ARTICLE:
1703
+ case LXB_TAG_ASIDE:
1704
+ case LXB_TAG_BLOCKQUOTE:
1705
+ case LXB_TAG_BUTTON:
1706
+ case LXB_TAG_CENTER:
1707
+ case LXB_TAG_DETAILS:
1708
+ case LXB_TAG_DIALOG:
1709
+ case LXB_TAG_DIR:
1710
+ case LXB_TAG_DIV:
1711
+ case LXB_TAG_DL:
1712
+ case LXB_TAG_FIELDSET:
1713
+ case LXB_TAG_FIGCAPTION:
1714
+ case LXB_TAG_FIGURE:
1715
+ case LXB_TAG_FOOTER:
1716
+ case LXB_TAG_HEADER:
1717
+ case LXB_TAG_HGROUP:
1718
+ case LXB_TAG_LISTING:
1719
+ case LXB_TAG_MAIN:
1720
+ case LXB_TAG_MENU:
1721
+ case LXB_TAG_NAV:
1722
+ case LXB_TAG_OL:
1723
+ case LXB_TAG_PRE:
1724
+ case LXB_TAG_SECTION:
1725
+ case LXB_TAG_SUMMARY:
1726
+ case LXB_TAG_UL:
1727
+ return lxb_html_tree_insertion_mode_in_body_abcdfhlmnopsu_closed(tree,
1728
+ token);
1729
+ case LXB_TAG_FORM:
1730
+ return lxb_html_tree_insertion_mode_in_body_form_closed(tree,
1731
+ token);
1732
+ case LXB_TAG_P:
1733
+ return lxb_html_tree_insertion_mode_in_body_p_closed(tree,
1734
+ token);
1735
+ case LXB_TAG_LI:
1736
+ return lxb_html_tree_insertion_mode_in_body_li_closed(tree,
1737
+ token);
1738
+ case LXB_TAG_DD:
1739
+ case LXB_TAG_DT:
1740
+ return lxb_html_tree_insertion_mode_in_body_dd_dt_closed(tree,
1741
+ token);
1742
+ case LXB_TAG_H1:
1743
+ case LXB_TAG_H2:
1744
+ case LXB_TAG_H3:
1745
+ case LXB_TAG_H4:
1746
+ case LXB_TAG_H5:
1747
+ case LXB_TAG_H6:
1748
+ return lxb_html_tree_insertion_mode_in_body_h123456_closed(tree,
1749
+ token);
1750
+ case LXB_TAG_A:
1751
+ case LXB_TAG_B:
1752
+ case LXB_TAG_BIG:
1753
+ case LXB_TAG_CODE:
1754
+ case LXB_TAG_EM:
1755
+ case LXB_TAG_FONT:
1756
+ case LXB_TAG_I:
1757
+ case LXB_TAG_NOBR:
1758
+ case LXB_TAG_S:
1759
+ case LXB_TAG_SMALL:
1760
+ case LXB_TAG_STRIKE:
1761
+ case LXB_TAG_STRONG:
1762
+ case LXB_TAG_TT:
1763
+ case LXB_TAG_U:
1764
+ return lxb_html_tree_insertion_mode_in_body_abcefinstu_closed(tree,
1765
+ token);
1766
+ case LXB_TAG_APPLET:
1767
+ case LXB_TAG_MARQUEE:
1768
+ case LXB_TAG_OBJECT:
1769
+ return lxb_html_tree_insertion_mode_in_body_amo_closed(tree,
1770
+ token);
1771
+ case LXB_TAG_BR:
1772
+ return lxb_html_tree_insertion_mode_in_body_br_closed(tree,
1773
+ token);
1774
+
1775
+ default:
1776
+ return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
1777
+ token);
1778
+ }
1779
+ }
1780
+
1781
+ switch (token->tag_id) {
1782
+ case LXB_TAG__TEXT:
1783
+ return lxb_html_tree_insertion_mode_in_body_text(tree, token);
1784
+
1785
+ case LXB_TAG__EM_COMMENT:
1786
+ return lxb_html_tree_insertion_mode_in_body_comment(tree, token);
1787
+
1788
+ case LXB_TAG__EM_DOCTYPE:
1789
+ return lxb_html_tree_insertion_mode_in_body_doctype(tree, token);
1790
+
1791
+ case LXB_TAG_HTML:
1792
+ return lxb_html_tree_insertion_mode_in_body_html(tree, token);
1793
+
1794
+ case LXB_TAG_BASE:
1795
+ case LXB_TAG_BASEFONT:
1796
+ case LXB_TAG_BGSOUND:
1797
+ case LXB_TAG_LINK:
1798
+ case LXB_TAG_META:
1799
+ case LXB_TAG_NOFRAMES:
1800
+ case LXB_TAG_SCRIPT:
1801
+ case LXB_TAG_STYLE:
1802
+ case LXB_TAG_TEMPLATE:
1803
+ case LXB_TAG_TITLE:
1804
+ return lxb_html_tree_insertion_mode_in_body_blmnst(tree, token);
1805
+
1806
+ case LXB_TAG_BODY:
1807
+ return lxb_html_tree_insertion_mode_in_body_body(tree, token);
1808
+
1809
+ case LXB_TAG_FRAMESET:
1810
+ return lxb_html_tree_insertion_mode_in_body_frameset(tree, token);
1811
+
1812
+ case LXB_TAG__END_OF_FILE:
1813
+ return lxb_html_tree_insertion_mode_in_body_eof(tree, token);
1814
+
1815
+ case LXB_TAG_ADDRESS:
1816
+ case LXB_TAG_ARTICLE:
1817
+ case LXB_TAG_ASIDE:
1818
+ case LXB_TAG_BLOCKQUOTE:
1819
+ case LXB_TAG_CENTER:
1820
+ case LXB_TAG_DETAILS:
1821
+ case LXB_TAG_DIALOG:
1822
+ case LXB_TAG_DIR:
1823
+ case LXB_TAG_DIV:
1824
+ case LXB_TAG_DL:
1825
+ case LXB_TAG_FIELDSET:
1826
+ case LXB_TAG_FIGCAPTION:
1827
+ case LXB_TAG_FIGURE:
1828
+ case LXB_TAG_FOOTER:
1829
+ case LXB_TAG_HEADER:
1830
+ case LXB_TAG_HGROUP:
1831
+ case LXB_TAG_MAIN:
1832
+ case LXB_TAG_MENU:
1833
+ case LXB_TAG_NAV:
1834
+ case LXB_TAG_OL:
1835
+ case LXB_TAG_P:
1836
+ case LXB_TAG_SECTION:
1837
+ case LXB_TAG_SUMMARY:
1838
+ case LXB_TAG_UL:
1839
+ return lxb_html_tree_insertion_mode_in_body_abcdfhmnopsu(tree,
1840
+ token);
1841
+
1842
+ case LXB_TAG_H1:
1843
+ case LXB_TAG_H2:
1844
+ case LXB_TAG_H3:
1845
+ case LXB_TAG_H4:
1846
+ case LXB_TAG_H5:
1847
+ case LXB_TAG_H6:
1848
+ return lxb_html_tree_insertion_mode_in_body_h123456(tree, token);
1849
+
1850
+ case LXB_TAG_PRE:
1851
+ case LXB_TAG_LISTING:
1852
+ return lxb_html_tree_insertion_mode_in_body_pre_listing(tree,
1853
+ token);
1854
+
1855
+ case LXB_TAG_FORM:
1856
+ return lxb_html_tree_insertion_mode_in_body_form(tree, token);
1857
+
1858
+ case LXB_TAG_LI:
1859
+ return lxb_html_tree_insertion_mode_in_body_li(tree, token);
1860
+
1861
+ case LXB_TAG_DD:
1862
+ case LXB_TAG_DT:
1863
+ return lxb_html_tree_insertion_mode_in_body_dd_dt(tree, token);
1864
+
1865
+ case LXB_TAG_PLAINTEXT:
1866
+ return lxb_html_tree_insertion_mode_in_body_plaintext(tree, token);
1867
+
1868
+ case LXB_TAG_BUTTON:
1869
+ return lxb_html_tree_insertion_mode_in_body_button(tree, token);
1870
+
1871
+ case LXB_TAG_A:
1872
+ return lxb_html_tree_insertion_mode_in_body_a(tree, token);
1873
+
1874
+ case LXB_TAG_B:
1875
+ case LXB_TAG_BIG:
1876
+ case LXB_TAG_CODE:
1877
+ case LXB_TAG_EM:
1878
+ case LXB_TAG_FONT:
1879
+ case LXB_TAG_I:
1880
+ case LXB_TAG_S:
1881
+ case LXB_TAG_SMALL:
1882
+ case LXB_TAG_STRIKE:
1883
+ case LXB_TAG_STRONG:
1884
+ case LXB_TAG_TT:
1885
+ case LXB_TAG_U:
1886
+ return lxb_html_tree_insertion_mode_in_body_bcefistu(tree, token);
1887
+
1888
+ case LXB_TAG_NOBR:
1889
+ return lxb_html_tree_insertion_mode_in_body_nobr(tree, token);
1890
+
1891
+ case LXB_TAG_APPLET:
1892
+ case LXB_TAG_MARQUEE:
1893
+ case LXB_TAG_OBJECT:
1894
+ return lxb_html_tree_insertion_mode_in_body_amo(tree, token);
1895
+
1896
+ case LXB_TAG_TABLE:
1897
+ return lxb_html_tree_insertion_mode_in_body_table(tree, token);
1898
+
1899
+ case LXB_TAG_AREA:
1900
+ case LXB_TAG_BR:
1901
+ case LXB_TAG_EMBED:
1902
+ case LXB_TAG_IMG:
1903
+ case LXB_TAG_KEYGEN:
1904
+ case LXB_TAG_WBR:
1905
+ return lxb_html_tree_insertion_mode_in_body_abeikw(tree, token);
1906
+
1907
+ case LXB_TAG_INPUT:
1908
+ return lxb_html_tree_insertion_mode_in_body_input(tree, token);
1909
+
1910
+ case LXB_TAG_PARAM:
1911
+ case LXB_TAG_SOURCE:
1912
+ case LXB_TAG_TRACK:
1913
+ return lxb_html_tree_insertion_mode_in_body_pst(tree, token);
1914
+
1915
+ case LXB_TAG_HR:
1916
+ return lxb_html_tree_insertion_mode_in_body_hr(tree, token);
1917
+
1918
+ case LXB_TAG_IMAGE:
1919
+ return lxb_html_tree_insertion_mode_in_body_image(tree, token);
1920
+
1921
+ case LXB_TAG_TEXTAREA:
1922
+ return lxb_html_tree_insertion_mode_in_body_textarea(tree, token);
1923
+
1924
+ case LXB_TAG_XMP:
1925
+ return lxb_html_tree_insertion_mode_in_body_xmp(tree, token);
1926
+
1927
+ case LXB_TAG_IFRAME:
1928
+ return lxb_html_tree_insertion_mode_in_body_iframe(tree, token);
1929
+
1930
+ case LXB_TAG_NOEMBED:
1931
+ return lxb_html_tree_insertion_mode_in_body_noembed(tree, token);
1932
+
1933
+ case LXB_TAG_NOSCRIPT:
1934
+ return lxb_html_tree_insertion_mode_in_body_noscript(tree, token);
1935
+
1936
+ case LXB_TAG_SELECT:
1937
+ return lxb_html_tree_insertion_mode_in_body_select(tree, token);
1938
+
1939
+ case LXB_TAG_OPTGROUP:
1940
+ case LXB_TAG_OPTION:
1941
+ return lxb_html_tree_insertion_mode_in_body_optopt(tree, token);
1942
+
1943
+ case LXB_TAG_RB:
1944
+ case LXB_TAG_RTC:
1945
+ return lxb_html_tree_insertion_mode_in_body_rbrtc(tree, token);
1946
+
1947
+ case LXB_TAG_RP:
1948
+ case LXB_TAG_RT:
1949
+ return lxb_html_tree_insertion_mode_in_body_rprt(tree, token);
1950
+
1951
+ case LXB_TAG_MATH:
1952
+ return lxb_html_tree_insertion_mode_in_body_math(tree, token);
1953
+
1954
+ case LXB_TAG_SVG:
1955
+ return lxb_html_tree_insertion_mode_in_body_svg(tree, token);
1956
+
1957
+ case LXB_TAG_CAPTION:
1958
+ case LXB_TAG_COL:
1959
+ case LXB_TAG_COLGROUP:
1960
+ case LXB_TAG_FRAME:
1961
+ case LXB_TAG_HEAD:
1962
+ case LXB_TAG_TBODY:
1963
+ case LXB_TAG_TD:
1964
+ case LXB_TAG_TFOOT:
1965
+ case LXB_TAG_TH:
1966
+ case LXB_TAG_THEAD:
1967
+ case LXB_TAG_TR:
1968
+ return lxb_html_tree_insertion_mode_in_body_cfht(tree, token);
1969
+
1970
+ default:
1971
+ return lxb_html_tree_insertion_mode_in_body_anything_else(tree,
1972
+ token);
1973
+ }
1974
+ }