Class: Browser::CSS::Rule

Inherits:
Object show all
Includes:
Native
Defined in:
opal/browser/css/rule.rb,
opal/browser/css/rule/style.rb

Direct Known Subclasses

Style

Defined Under Namespace

Classes: Style

Constant Summary collapse

STYLE_RULE =
1
CHARSET_RULE =
2
IMPORT_RULE =
3
MEDIA_RULE =
4
FONT_FACE_RULE =
5
PAGE_RULE =
6
KEYFRAMES_RULE =
7
KEYFRAME_RULE =
8
NAMESPACE_RULE =
10
COUNTER_STYLE_RULE =
11
SUPPORTS_RULE =
12
DOCUMENT_RULE =
13
FONT_FEATURE_VALUES_RULE =
14
VIEWPORT_RULE =
15
REGION_STYLE_RULE =
16

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(rule) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'opal/browser/css/rule.rb', line 22

def self.new(rule)
  if self == Rule
    @classes ||= [nil, Style]

    if klass = @classes[`rule.type`]
      klass.new(rule)
    else
      raise ArgumentError, 'cannot instantiate a non derived Rule object'
    end
  else
    super(rule)
  end
end

Instance Method Details

#parentObject



39
40
41
# File 'opal/browser/css/rule.rb', line 39

def parent
  Rule.new(`#@native.parentRule`) if `#@native.parentRule != null`
end

#style_sheetObject



43
44
45
# File 'opal/browser/css/rule.rb', line 43

def style_sheet
  StyleSheet.new(`#@native.parentStyleSheet`) if `#@native.parentStyleSheet != null`
end