Class: Puppeteer::Bidi::QueryHandler::SelectorAnalysis Private
- Inherits:
-
Object
- Object
- Puppeteer::Bidi::QueryHandler::SelectorAnalysis
- Defined in:
- lib/puppeteer/bidi/query_handler.rb,
sig/puppeteer/bidi/query_handler.rbs
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #selector ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(selector) ⇒ SelectorAnalysis
constructor
private
A new instance of SelectorAnalysis.
- #pseudo_class_present? ⇒ Boolean private
- #requires_raf_polling? ⇒ Boolean private
Constructor Details
#initialize(selector) ⇒ SelectorAnalysis
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SelectorAnalysis.
37 38 39 |
# File 'lib/puppeteer/bidi/query_handler.rb', line 37 def initialize(selector) @selector = selector end |
Instance Attribute Details
#selector ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/puppeteer/bidi/query_handler.rb', line 35 def selector @selector end |
Instance Method Details
#pseudo_class_present? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/puppeteer/bidi/query_handler.rb', line 47 def pseudo_class_present? in_string = nil escape = false bracket_depth = 0 selector.each_char.with_index do |char, index| if escape escape = false next end if in_string if char == '\\' escape = true elsif char == in_string in_string = nil end next end case char when '"', "'" in_string = char when '[' bracket_depth += 1 when ']' bracket_depth -= 1 if bracket_depth.positive? when '\\' escape = true when ':' next_char = selector[index + 1] next if next_char == ':' return true if bracket_depth.zero? end end false end |
#requires_raf_polling? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/puppeteer/bidi/query_handler.rb', line 41 def requires_raf_polling? pseudo_class_present? end |