Skip to content
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

Test for fragment node before assuming a node doc pointer is a doc. #678

Merged
merged 1 commit into from
Jun 7, 2012

Conversation

ender672
Copy link
Member

The doc pointer on an xmlNode is not always an xmlDoc. The child of a document
fragment will point to the document fragment, which does not behave exactly
like an xmlDoc and doesn't have a nokogiriTuple.

This changeset tests for XML_DOCUMENT_FRAG_NODE before assuming that the doc
pointer is an xmlDoc.

This changes the NOKOGIRI_ROOT_NODE and NOKOGIRI_ROOT_NSDEF macros to functions
which test for this case.

Also check for this case in Nokogiri_wrap_xml_node.

This changeset adds a unit test which was copied from Kristi's bug report, #677

Reported-by: Kristi kristi.dev@gmail.com

The doc pointer on an xmlNode is not always an xmlDoc. The child of a document
fragment will point to the document fragment, which does not behave exactly
like an xmlDoc and doesn't have a nokogiriTuple.

This changeset tests for XML_DOCUMENT_FRAG_NODE before assuming that the doc
pointer is an xmlDoc.

This changes the NOKOGIRI_ROOT_NODE and NOKOGIRI_ROOT_NSDEF macros to functions
which test for this case.

Also check for this case in Nokogiri_wrap_xml_node.

This changeset adds a unit test which was copied from Kristi's bug report.

Reported-by: Kristi <kristi.dev@gmail.com>
@ender672
Copy link
Member Author

@flavorjones this changes two macros into functions. I suspect the performance implications are negligible, but would like to run it past you first.

@flavorjones
Copy link
Member

Sorry - somehow I missed this in my email inbox. I'll take a look today!

@flavorjones
Copy link
Member

Awesome. Merging. Thanks!

flavorjones added a commit that referenced this pull request Jun 7, 2012
Test for fragment node before assuming a node doc pointer is a doc.
@flavorjones flavorjones merged commit 4316ec6 into sparklemotion:master Jun 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants