From ee78fe3a1d815ebcbb860199b6da0cfbd745f8b7 Mon Sep 17 00:00:00 2001 From: Brandon Nguyen Date: Sat, 17 Jan 2026 00:22:24 -0600 Subject: [PATCH] fix: use translator's id_attribute in xpath_hash --- cssselect/xpath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cssselect/xpath.py b/cssselect/xpath.py index 96eac3f..749aa2b 100644 --- a/cssselect/xpath.py +++ b/cssselect/xpath.py @@ -407,7 +407,7 @@ def xpath_class(self, class_selector: Class) -> XPathExpr: def xpath_hash(self, id_selector: Hash) -> XPathExpr: """Translate an ID selector.""" xpath = self.xpath(id_selector.selector) - return self.xpath_attrib_equals(xpath, "@id", id_selector.id) + return self.xpath_attrib_equals(xpath, f"@{self.id_attribute}", id_selector.id) def xpath_element(self, selector: Element) -> XPathExpr: """Translate a type or universal selector."""