Use the descendant axis for CSS selectors.
Instead of using "descendant-or-self" Oga will use "descendant". This ensures that expressions such as "foo *" don't return a set also including the "foo" element. Nokogiri solves this problem in a somewhat different way by using //foo//* for the CSS expression "foo *". While this works in Nokogiri the expression "descendant-or-self::node()" is slow as a snail in Oga (due to its nature of retrieving _all_ nodes first). By using "descendant" we can work around this problem.
This commit is contained in:
1 parent
602f2fe8bb
commit
eb3a3e7630
20 files changed
+98
-112
No files matched your search
@@ -45,7 +45,7 @@ rule
|
||||
;
|
||||
|
||||
descendant_or_self
|
||||
: node_test { s(:axis, 'descendant-or-self', val[0]) }
|
||||
: node_test { s(:axis, 'descendant', val[0]) }
|
||||
;
|
||||
|
||||
axis
|
||||
|
||||
Reference in new issue
Block a user