Rudy Celekli

Upstream contribution · antchfx/htmlquery

htmlquery · Returning the XPath string value of an HTML document

Rudy Celekli’s engineering portfolio · AI-assisted summary

Problem

HTML XPath queries could return an empty string when selecting the root document, even if descendant elements contained text. This affected string(/), root-context string(), and predicates that ask whether the document contains text.

Engineering response

The navigator reuses the existing InnerText traversal for the document node, bringing its value into line with XPath's root-node string-value rule.

Evidence and scope

The regression tests cover root-context string and contains expressions and retain element and comment controls. The cited PR gives the XPath specification reference and reports local Go validation.