6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/kitchen/directions/bake_first_elements.rb', line 6
def self.v1(within:, first_inline_list: false)
selectors = [
'div.os-problem-container > div.os-table',
'div.os-problem-container > span[data-type="media"]',
'div.os-problem-container > div.os-figure',
'div.os-solution-container > div.os-table',
'div.os-solution-container > span[data-type="media"]',
'div.os-solution-container > div.os-figure'
]
selectors.each do |selector|
within.search("#{selector}:first-child").each do |problem|
problem.add_class('first-element')
problem.parent.add_class('has-first-element')
end
end
return unless first_inline_list
inline_selector = 'div.os-solution-container > ol[type="1"]:first-child,' \
'div.os-problem-container > ol[type="1"]:first-child'
within.search(inline_selector).each do |inline_list|
inline_list.add_class('first-inline-list-element')
inline_list.parent.add_class('has-first-inline-list-element')
end
end
|