Skip to content
Snippets Groups Projects

Feature to create directly addressed Todos when mentioned in beginning

All threads resolved!
Compare and Show latest version
4 files
+ 315
29
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 4
2
module Banzai
module Banzai
module Querying
module Querying
module_function
module_function
 
# Searches a Nokogiri document using a CSS query, optionally optimizing it
# Searches a Nokogiri document using a CSS query, optionally optimizing it
# whenever possible.
# whenever possible.
#
#
@@ -8,7 +9,8 @@ module Querying
@@ -8,7 +9,8 @@ module Querying
# query - The CSS query to use.
# query - The CSS query to use.
# reference_options - A hash with nodes filter options
# reference_options - A hash with nodes filter options
#
#
# Returns a Nokogiri::XML::NodeSet.
# Returns an array of Nokogiri::XML::Element objects if location is specified
 
# in reference_options. Otherwise it would a Nokogiri::XML::NodeSet.
def css(document, query, reference_options = {})
def css(document, query, reference_options = {})
# When using "a.foo" Nokogiri compiles this to "//a[...]" but
# When using "a.foo" Nokogiri compiles this to "//a[...]" but
# "descendant::a[...]" is quite a bit faster and achieves the same result.
# "descendant::a[...]" is quite a bit faster and achieves the same result.
@@ -26,7 +28,7 @@ def filter_nodes(nodes, reference_options)
@@ -26,7 +28,7 @@ def filter_nodes(nodes, reference_options)
end
end
end
end
# Selects nodes if they are present in the beginning of the document.
# Selects nodes which are present in the beginning of the document.
#
#
# nodes - A Nokogiri::XML::NodeSet.
# nodes - A Nokogiri::XML::NodeSet.
#
#
Loading