-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
v1.56 changes attribute fetching #816
Comments
I did some testing, a4bd937 seems to be the commit that changed this. |
Can you provide the output of |
Nokogiri (1.5.6)
|
Thanks for the output and for reporting the bug. This behavior was changed for MRI, for more information see #712. I'll go ahead and close this issue since it's not a bug. |
That's a pretty significant interface change for a patch level release. -1 |
There's still some weirdness in the (perfectly legal and kinda common) case where an element has a prefixed attribute in the same namespace. For example:
The fact that #attributes comes back with non-prefixed keys for attributes that can only be accessed with a prefix is a bit counterintuitive, as is the fact that "veg:carrot/@veg:color" is in the veg namespace while "veg:carrot/@Length" has a nil namespace, since non-prefixed attributes are assumed to be in the element's namespace. |
@jcoyne Thanks for weighing in! @mbklein I'm looking into it. Sorry for the confusion here, everyone. See the discussion on #712 for our rationale. Yes, a change like this shouldn't normally be in a patch release, however we consider JRuby/CRuby incompatibilities as bugs, since there's a significant number of users who expect, correctly, to be able to write platform-agnostic Nokogiri code. |
@mbklein Can you provide a test case that succeeds under 1.5.5 and fails under 1.5.6? Or at least a test case that asserts what you believe the functionality should be (or was, previously)? I want to make sure I understand your comments above, and I'm not sure I do right now. |
@mbklein or, is this test sufficiently describing the issue:
|
Sorry for the confusion – this isn't something that changed between 1.5.5 and 1.5.6, or a new inconsistency. It's part of my ongoing campaign to clean up namespace behavior in general, and it reared its head in this issue. I also had a minor misconception about default namespaces for unprefixed elements, so I'm abandoning that line of thought. The primary issue I have is that I just whipped up a contrived test case. Comments are based on current (1.5.6) behavior, which I now see as an incremental improvement on 1.5.5 behavior (all issues about minor vs. patch releases aside).
|
I have a fix in mind that would satisfy the assertions in section 3, but it would still be a big change to current behavior. You'll probably see a pull request from me on it later today. |
@mbklein - I'd love to see your fix for this, if you've still got it somewhere. |
Yeah, I've got it in a branch. I'll rebase it on trunk and see what kind of shape it's in. |
In 21f18de back in 2021 I wrote quite a bit of documentation to help users understand that |
1.56 seems to be requiring namespaces for fetching attribute values, while 1.55 would fail if you tried to include the namespace. Here is a test that demonstrates what I am seeing.
The text was updated successfully, but these errors were encountered: