-
-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] HTML5 parser loses reference to url
parameter value
#2583
Comments
jgarber623
added
the
state/needs-triage
Inbox for non-installation-related bug reports or help requests
label
Jun 23, 2022
@jgarber623 Thanks for reporting this! I'll take a look as soon as I can, but after a brief glance it seems like something we can easily fix. |
flavorjones
removed
the
state/needs-triage
Inbox for non-installation-related bug reports or help requests
label
Jun 23, 2022
flavorjones
added a commit
that referenced
this issue
Jun 23, 2022
This matches the behavior of HTML4::Document and XML::Document. Previously this method always returned `nil`. Fixes #2583
PR is at #2584 |
@flavorjones Thanks for the quick fix! Tested and reviewed your changes in #2584 and everything looks good. |
jgarber623
added a commit
to jgarber623/micromicro
that referenced
this issue
Mar 14, 2023
MicroMicro can use this now that Nokogiri 1.14 is out, which includes: sparklemotion/nokogiri#2583
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please describe the bug
Invocations of
Nokogiri::HTML4()
andNokogiri::HTML5()
both support optional second parameters representing the parsed document's URL:The resulting
Nokogiri::HTMLx::Document
instance responds to aurl
method that should return the string value passed toNokogiri::HTML4
/Nokogiri::HTML5
. This works with the HTML4 parser (alternatively invoked asNokogiri::HTML()
) but the HTML5 parser consistently returnsnil
.I did my best to trace the code path from
Nokogiri::HTML5()
downward, but I got lost inNokogiri::HTML5::Document
's privatedo_parse
method (source):Specifically, I couldn't locate source for the
Nokogiri::Gumbo.parse
call on line 66. I suspect this code may be generated from C code which is beyond my level of understanding. Is that the case? Did I miss something?Help us reproduce what you're seeing
Save the following script as
test.rb
(or similar) and run viaruby test.rb
.Expected behavior
I expected that a call to
Nokogiri::HTML5(markup, url).url
would return the value passed as the second parameter, consistent with the HTML4 parser.Environment
Additional context
I'm currently using the HTML4 parser in some code and relying on the
url
parameter to resolve relative URLs in parsed markup. I discovered the above documented inconsistency while updating that code to use the newer HTML5 parser.Thanks for reading and I appreciate your help!
The text was updated successfully, but these errors were encountered: