Sha256: 52b996532f01a1de073499bcd867f62b70b94aeb5d5ed59218375f363ec3ad34
Contents?: true
Size: 990 Bytes
Versions: 1
Compression:
Stored size: 990 Bytes
Contents
# frozen_string_literal: true module Kitchen module Directions module BakeFirstElements def self.v1(within:) # add has-first-element class selectors = [ 'div.os-problem-container > div.os-table', 'div.os-problem-container > span[data-type="media"]', 'div.os-solution-container > div.os-table', 'div.os-solution-container > span[data-type="media"]' ] 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 # add first-inline-element class inline_list = within&.first('div.os-solution-container > ol[type="1"]:first-child') return unless inline_list inline_list.add_class('first-inline-list-element') inline_list.parent.add_class('has-first-inline-list-element') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openstax_kitchen-9.2.0 | lib/kitchen/directions/bake_first_elements.rb |