14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/csspool/lib_croco/cr_additional_sel.rb', line 14
def to_additional_selector
case self[:sel_type]
when 1 CSSPool::Selectors::Class.new(
LibCroco.cr_string_peek_raw_str(self[:content]).read_string
)
when 1 << 1 pseudo = CRPseudo.new(self[:content])
CSSPool::Selectors::PseudoClass.new(
pseudo[:name].null? ? nil :
LibCroco.cr_string_peek_raw_str(pseudo[:name]).read_string,
pseudo[:extra].null? ? nil :
LibCroco.cr_string_peek_raw_str(pseudo[:extra]).read_string
)
when 1 << 3 CSSPool::Selectors::Id.new(
LibCroco.cr_string_peek_raw_str(self[:content]).read_string
)
when 1 << 4 attr_sel = CRAttrSel.new(self[:content])
raise "FIXME: additional add selectors" unless attr_sel[:next].null?
CSSPool::Selectors::Attribute.new(
attr_sel[:name].null? ? nil :
LibCroco.cr_string_peek_raw_str(attr_sel[:name]).read_string,
attr_sel[:value].null? ? nil :
LibCroco.cr_string_peek_raw_str(attr_sel[:value]).read_string,
attr_sel[:match_way]
)
end
end
|