Skip to content

Commit e9e3d98

Browse files
committed
feat: gumbo support for <hr> in <select>
- whatwg/html#3410 - whatwg/html#9124 - html5lib/html5lib-tests#167
1 parent b5ef1ef commit e9e3d98

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ You can read more about this in the decision record at `adr/2023-04-libxml-memor
4646
* [CRuby] The C extension now uses Ruby's [TypedData API](https://docs.ruby-lang.org/en/3.0/extension_rdoc.html#label-Encapsulate+C+Data+into+a+Ruby+Object) for managing all the libxml2 structs. Write barriers may improve GC performance in some extreme cases. [[#2808](https://github.com/sparklemotion/nokogiri/issues/2808)] (Thanks, [@etiennebarrie](https://github.com/etiennebarrie) and [@byroot](https://github.com/byroot)!)
4747
* [CRuby] `ObjectSpace.memsize_of` reports a pretty good guess of memory usage when called on `Nokogiri::XML::Document` objects. [[#2807](https://github.com/sparklemotion/nokogiri/issues/2807)] (Thanks, [@etiennebarrie](https://github.com/etiennebarrie) and [@byroot](https://github.com/byroot)!)
4848
* [CRuby] Users installing the "ruby" platform gem and compiling libxml2 and libxslt from source will now be using a modern `config.guess` and `config.sub` that supports new architectures like `loongarch64`. [[#2831](https://github.com/sparklemotion/nokogiri/issues/2831)] (Thanks, [@zhangwenlong8911](https://github.com/zhangwenlong8911)!)
49-
* [CRuby] HTML5 parser now adjusts the specified attributes, adding `xlink:arcrole` and removing `xml:base` [[#2841](https://github.com/sparklemotion/nokogiri/issues/2841), [#2842](https://github.com/sparklemotion/nokogiri/issues/2842)]
5049
* [JRuby] `Node#first_element_child` now returns `nil` if there are only non-element children. [[#2808](https://github.com/sparklemotion/nokogiri/issues/2808), [#2844](https://github.com/sparklemotion/nokogiri/issues/2844)]
5150
* Documentation for `Nokogiri::XSLT` now has usage examples including custom function handlers.
51+
* [CRuby] HTML5 parser:
52+
* adjusts the specified attributes, adding `xlink:arcrole` and removing `xml:base` [[#2841](https://github.com/sparklemotion/nokogiri/issues/2841), [#2842](https://github.com/sparklemotion/nokogiri/issues/2842)]
53+
* allows `<hr>` in `<select>` [[whatwg/html#3410](https://github.com/whatwg/html/issues/3410), [whatwg/html#9124](https://github.com/whatwg/html/pull/9124)]
5254

5355

5456
### Deprecated

gumbo-parser/src/parser.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3964,6 +3964,18 @@ static void handle_in_select(GumboParser* parser, GumboToken* token) {
39643964
insert_element_from_token(parser, token);
39653965
return;
39663966
}
3967+
if (tag_is(token, kStartTag, GUMBO_TAG_HR)) {
3968+
if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTION)) {
3969+
pop_current_node(parser);
3970+
}
3971+
if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTGROUP)) {
3972+
pop_current_node(parser);
3973+
}
3974+
insert_element_from_token(parser, token);
3975+
pop_current_node(parser);
3976+
acknowledge_self_closing_tag(parser);
3977+
return;
3978+
}
39673979
if (tag_is(token, kEndTag, GUMBO_TAG_OPTGROUP)) {
39683980
GumboVector* open_elements = &parser->_parser_state->_open_elements;
39693981
if (

0 commit comments

Comments
 (0)