hatemile 2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/Gemfile +9 -0
- data/LICENSE +202 -0
- data/Rakefile +64 -0
- data/hatemile.gemspec +37 -0
- data/lib/hatemile/accessible_association.rb +62 -0
- data/lib/hatemile/accessible_css.rb +43 -0
- data/lib/hatemile/accessible_display.rb +178 -0
- data/lib/hatemile/accessible_event.rb +95 -0
- data/lib/hatemile/accessible_form.rb +101 -0
- data/lib/hatemile/accessible_navigation.rb +82 -0
- data/lib/hatemile/helper.rb +58 -0
- data/lib/hatemile/implementation/accessible_association_implementation.rb +346 -0
- data/lib/hatemile/implementation/accessible_css_implementation.rb +772 -0
- data/lib/hatemile/implementation/accessible_display_implementation.rb +1362 -0
- data/lib/hatemile/implementation/accessible_event_implementation.rb +278 -0
- data/lib/hatemile/implementation/accessible_form_implementation.rb +386 -0
- data/lib/hatemile/implementation/accessible_navigation_implementation.rb +561 -0
- data/lib/hatemile/util/common_functions.rb +106 -0
- data/lib/hatemile/util/configure.rb +92 -0
- data/lib/hatemile/util/css/rcp/rcp_declaration.rb +77 -0
- data/lib/hatemile/util/css/rcp/rcp_parser.rb +115 -0
- data/lib/hatemile/util/css/rcp/rcp_rule.rb +86 -0
- data/lib/hatemile/util/css/style_sheet_declaration.rb +59 -0
- data/lib/hatemile/util/css/style_sheet_parser.rb +43 -0
- data/lib/hatemile/util/css/style_sheet_rule.rb +73 -0
- data/lib/hatemile/util/html/html_dom_element.rb +234 -0
- data/lib/hatemile/util/html/html_dom_node.rb +131 -0
- data/lib/hatemile/util/html/html_dom_parser.rb +150 -0
- data/lib/hatemile/util/html/html_dom_text_node.rb +43 -0
- data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_element.rb +302 -0
- data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_node.rb +112 -0
- data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_parser.rb +208 -0
- data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_text_node.rb +83 -0
- data/lib/hatemile/util/id_generator.rb +53 -0
- data/lib/js/common.js +98 -0
- data/lib/js/eventlistener.js +36 -0
- data/lib/js/include.js +292 -0
- data/lib/js/scriptlist_validation_fields.js +13 -0
- data/lib/js/validation.js +205 -0
- data/lib/locale/en-US.yml +388 -0
- data/lib/locale/pt-BR.yml +389 -0
- data/lib/skippers.xml +6 -0
- data/lib/symbols.xml +40 -0
- data/test/locale/en-US.yml +5 -0
- data/test/locale/pt-BR.yml +4 -0
- data/test/test_accessible_association_implementation.rb +258 -0
- data/test/test_accessible_css_implementation.rb +518 -0
- data/test/test_accessible_display_implementation.rb +873 -0
- data/test/test_accessible_form_implementation.rb +283 -0
- data/test/test_accessible_navigation_implementation.rb +228 -0
- data/test/test_common_functions.rb +128 -0
- data/test/test_configure.rb +73 -0
- data/test/test_nokogiri_html_dom_element.rb +586 -0
- data/test/test_nokogiri_html_dom_parser.rb +363 -0
- data/test/test_nokogiri_html_dom_text_node.rb +225 -0
- data/test/test_rcp_declaration.rb +103 -0
- data/test/test_rcp_parser.rb +86 -0
- data/test/test_rcp_rule.rb +89 -0
- metadata +199 -0
@@ -0,0 +1,106 @@
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
# you may not use this file except in compliance with the License.
|
3
|
+
# You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
##
|
14
|
+
# The Hatemile module contains the interfaces with the acessibility solutions.
|
15
|
+
module Hatemile
|
16
|
+
##
|
17
|
+
# The Hatemile::Util module contains the utilities of library.
|
18
|
+
module Util
|
19
|
+
##
|
20
|
+
# The CommonFunctions module contains the used methods by HaTeMiLe classes.
|
21
|
+
module CommonFunctions
|
22
|
+
##
|
23
|
+
# The name of attribute for not modify the elements.
|
24
|
+
DATA_IGNORE = 'data-ignoreaccessibilityfix'.freeze
|
25
|
+
|
26
|
+
##
|
27
|
+
# Copy a list of attributes of a element for other element.
|
28
|
+
#
|
29
|
+
# @param element1 [Hatemile::Util::Html::HTMLDOMElement] The element that
|
30
|
+
# have attributes copied.
|
31
|
+
# @param element2 [Hatemile::Util::Html::HTMLDOMElement] The element that
|
32
|
+
# copy the attributes.
|
33
|
+
# @param attributes [Array<String>] The list of attributes that will be
|
34
|
+
# copied.
|
35
|
+
# @return [void]
|
36
|
+
def self.set_list_attributes(element1, element2, attributes)
|
37
|
+
attributes.each do |attribute|
|
38
|
+
if element1.has_attribute?(attribute)
|
39
|
+
element2.set_attribute(attribute, element1.get_attribute(attribute))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Increase a item in a HTML list.
|
46
|
+
#
|
47
|
+
# @param list [String] The list.
|
48
|
+
# @param string_to_increase [String] The value of item.
|
49
|
+
# @return [String] The HTML list with the item added, if the item not was
|
50
|
+
# contained in list.
|
51
|
+
def self.increase_in_list(list, string_to_increase)
|
52
|
+
if !list.nil? &&
|
53
|
+
!list.empty? &&
|
54
|
+
!string_to_increase.nil? &&
|
55
|
+
!string_to_increase.empty?
|
56
|
+
return list if in_list?(list, string_to_increase)
|
57
|
+
return "#{list} #{string_to_increase}"
|
58
|
+
elsif !list.nil? && !list.empty?
|
59
|
+
return list
|
60
|
+
end
|
61
|
+
string_to_increase
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# Verify if the list contains the item.
|
66
|
+
#
|
67
|
+
# @param list [String] The list.
|
68
|
+
# @param string_to_search [String] The value of item.
|
69
|
+
# @return [Boolean] True if the list contains the item or false is not
|
70
|
+
# contains.
|
71
|
+
def self.in_list?(list, string_to_search)
|
72
|
+
if !list.nil? &&
|
73
|
+
!list.empty? &&
|
74
|
+
!string_to_search.nil? &&
|
75
|
+
!string_to_search.empty?
|
76
|
+
elements = list.split(/[ \n\t\r]+/)
|
77
|
+
elements.each do |element|
|
78
|
+
return true if element == string_to_search
|
79
|
+
end
|
80
|
+
end
|
81
|
+
false
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Check that the element can be manipulated by HaTeMiLe.
|
86
|
+
#
|
87
|
+
# @param element [Hatemile::Util::Html::HTMLDOMElement] The element.
|
88
|
+
# @return [Boolean] True if element can be manipulated or false if element
|
89
|
+
# cannot be manipulated.
|
90
|
+
def self.is_valid_element?(element)
|
91
|
+
return false if element.has_attribute?(DATA_IGNORE)
|
92
|
+
|
93
|
+
parent_element = element.get_parent_element
|
94
|
+
|
95
|
+
return true if parent_element.nil?
|
96
|
+
|
97
|
+
tag_name = parent_element.get_tag_name
|
98
|
+
if (tag_name != 'BODY') && (tag_name != 'HTML')
|
99
|
+
return is_valid_element?(parent_element)
|
100
|
+
end
|
101
|
+
|
102
|
+
true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
# you may not use this file except in compliance with the License.
|
3
|
+
# You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
require 'yaml'
|
14
|
+
require File.join(File.dirname(File.dirname(__FILE__)), 'helper')
|
15
|
+
|
16
|
+
##
|
17
|
+
# The Hatemile module contains the interfaces with the acessibility solutions.
|
18
|
+
module Hatemile
|
19
|
+
##
|
20
|
+
# The Hatemile::Util module contains the utilities of library.
|
21
|
+
module Util
|
22
|
+
##
|
23
|
+
# The Configure class contains the configuration of HaTeMiLe.
|
24
|
+
class Configure
|
25
|
+
##
|
26
|
+
# Initializes a new object that contains the configuration of HaTeMiLe.
|
27
|
+
#
|
28
|
+
# @param files_name [Array<String>] The path of files.
|
29
|
+
# @param locales [Array<Symbol>] The locales.
|
30
|
+
def initialize(files_name = nil, locales = [:'en-US'])
|
31
|
+
Hatemile::Helper.require_valid_type(files_name, Array)
|
32
|
+
Hatemile::Helper.require_valid_type(files_name, Array)
|
33
|
+
|
34
|
+
if files_name.nil?
|
35
|
+
pattern = File.join(
|
36
|
+
File.dirname(File.dirname(File.dirname(__FILE__))),
|
37
|
+
'locale',
|
38
|
+
'*.yml'
|
39
|
+
)
|
40
|
+
files_name = Dir.glob(pattern)
|
41
|
+
end
|
42
|
+
@locales = locales
|
43
|
+
@parameters = {}
|
44
|
+
files_name.each do |file_name|
|
45
|
+
@parameters = @parameters.merge(YAML.load_file(file_name))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Returns the parameters of configuration.
|
51
|
+
#
|
52
|
+
# @return [Hash] The parameters of configuration.
|
53
|
+
def get_parameters
|
54
|
+
clone_parameters = {}
|
55
|
+
@locales.each do |locale|
|
56
|
+
clone_parameters = @parameters[locale.to_s]['hatemile'].merge(
|
57
|
+
clone_parameters
|
58
|
+
)
|
59
|
+
end
|
60
|
+
clone_parameters
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Check that the configuration has an parameter.
|
65
|
+
#
|
66
|
+
# @param parameter [String] The parameter.
|
67
|
+
# @return [Boolean] True if the configuration has the parameter or false
|
68
|
+
# if the configuration not has the parameter.
|
69
|
+
def has_parameter?(parameter)
|
70
|
+
@locales.each do |locale|
|
71
|
+
return true if @parameters[locale.to_s]['hatemile'].key?(parameter)
|
72
|
+
end
|
73
|
+
false
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Returns the value of a parameter of configuration.
|
78
|
+
#
|
79
|
+
# @param parameter [String] The parameter.
|
80
|
+
# @return [String] The value of the parameter.
|
81
|
+
def get_parameter(parameter)
|
82
|
+
@locales.each do |locale|
|
83
|
+
next if @locales.last == locale
|
84
|
+
|
85
|
+
value = @parameters[locale.to_s]['hatemile'].fetch(parameter, nil)
|
86
|
+
return value unless value.nil?
|
87
|
+
end
|
88
|
+
@parameters[@locales.last.to_s]['hatemile'].fetch(parameter)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
# you may not use this file except in compliance with the License.
|
3
|
+
# You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
require File.join(
|
14
|
+
File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))),
|
15
|
+
'helper'
|
16
|
+
)
|
17
|
+
require File.join(
|
18
|
+
File.dirname(File.dirname(__FILE__)),
|
19
|
+
'style_sheet_declaration'
|
20
|
+
)
|
21
|
+
|
22
|
+
##
|
23
|
+
# The Hatemile module contains the interfaces with the acessibility solutions.
|
24
|
+
module Hatemile
|
25
|
+
##
|
26
|
+
# The Hatemile::Util module contains the utilities of library.
|
27
|
+
module Util
|
28
|
+
##
|
29
|
+
# The Hatemile::Util::Css module contains the interfaces of CSS handles.
|
30
|
+
module Css
|
31
|
+
##
|
32
|
+
# The Hatemile::Util::Css::Rcp module contains the implementation of CSS
|
33
|
+
# handles for Ruby CSS Parser library.
|
34
|
+
module Rcp
|
35
|
+
##
|
36
|
+
# The RCPDeclaration class is official implementation of
|
37
|
+
# Hatemile::Util::Css::StyleSheetDeclaration for Ruby CSS Parser.
|
38
|
+
class RCPDeclaration < Hatemile::Util::Css::StyleSheetDeclaration
|
39
|
+
public_class_method :new
|
40
|
+
|
41
|
+
##
|
42
|
+
# Initializes a new object that encapsulate the Ruby CSS Parser
|
43
|
+
# declaration.
|
44
|
+
#
|
45
|
+
# @param property_name [String] The property name of declaration.
|
46
|
+
# @param value [String] The value of declaration.
|
47
|
+
def initialize(property_name, value)
|
48
|
+
Hatemile::Helper.require_not_nil(property_name, value)
|
49
|
+
Hatemile::Helper.require_valid_type(property_name, String)
|
50
|
+
Hatemile::Helper.require_valid_type(value, String)
|
51
|
+
|
52
|
+
@property_name = property_name
|
53
|
+
@value = value
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# @see Hatemile::Util::Css::StyleSheetDeclaration#get_value
|
58
|
+
def get_value
|
59
|
+
@value
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# @see Hatemile::Util::Css::StyleSheetDeclaration#get_values
|
64
|
+
def get_values
|
65
|
+
get_value.split(/[ \n\t\r]+/)
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# @see Hatemile::Util::Css::StyleSheetDeclaration#get_property
|
70
|
+
def get_property
|
71
|
+
@property_name
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
# you may not use this file except in compliance with the License.
|
3
|
+
# You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
require 'css_parser'
|
14
|
+
require 'uri'
|
15
|
+
require File.join(
|
16
|
+
File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))),
|
17
|
+
'helper'
|
18
|
+
)
|
19
|
+
require File.join(File.dirname(File.dirname(__FILE__)), 'style_sheet_parser')
|
20
|
+
require File.join(File.dirname(__FILE__), 'rcp_rule')
|
21
|
+
|
22
|
+
##
|
23
|
+
# The Hatemile module contains the interfaces with the acessibility solutions.
|
24
|
+
module Hatemile
|
25
|
+
##
|
26
|
+
# The Hatemile::Util module contains the utilities of library.
|
27
|
+
module Util
|
28
|
+
##
|
29
|
+
# The Hatemile::Util::Css module contains the interfaces of CSS handles.
|
30
|
+
module Css
|
31
|
+
##
|
32
|
+
# The Hatemile::Util::Css::Rcp module contains the implementation of CSS
|
33
|
+
# handles for Ruby CSS Parser library.
|
34
|
+
module Rcp
|
35
|
+
##
|
36
|
+
# The RCPParser class is official implementation of
|
37
|
+
# Hatemile::Util::Css::StyleSheetParser for Ruby CSS Parser.
|
38
|
+
class RCPParser < Hatemile::Util::Css::StyleSheetParser
|
39
|
+
include CssParser
|
40
|
+
public_class_method :new
|
41
|
+
|
42
|
+
protected
|
43
|
+
|
44
|
+
##
|
45
|
+
# Load the stylesheets of page.
|
46
|
+
#
|
47
|
+
# @param html_parser [Hatemile::Util::Html::HTMLDOMParser] The HTML
|
48
|
+
# parser.
|
49
|
+
# @param current_url [String] The current URL of page.
|
50
|
+
def load_stylesheets(html_parser, current_url)
|
51
|
+
elements = html_parser.find(
|
52
|
+
'style,link[rel="stylesheet"]'
|
53
|
+
).list_results
|
54
|
+
elements.each do |element|
|
55
|
+
if element.get_tag_name == 'STYLE'
|
56
|
+
@css_parser.load_string!(element.get_text_content)
|
57
|
+
else
|
58
|
+
@css_parser.load_uri!(
|
59
|
+
URI.join(current_url, element.get_attribute('href'))
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
public
|
66
|
+
|
67
|
+
##
|
68
|
+
# Initializes a new object that encapsulate the Ruby CSS Parser.
|
69
|
+
#
|
70
|
+
# @param css_or_hp [String, Hatemile::Util::Html::HTMLDOMParser] The
|
71
|
+
# HTML parser or CSS code of page.
|
72
|
+
# @param current_url [String] The current URL of page.
|
73
|
+
def initialize(css_or_hp, current_url = nil)
|
74
|
+
Hatemile::Helper.require_not_nil(css_or_hp)
|
75
|
+
Hatemile::Helper.require_valid_type(
|
76
|
+
css_or_hp,
|
77
|
+
Hatemile::Util::Html::HTMLDOMParser,
|
78
|
+
String
|
79
|
+
)
|
80
|
+
Hatemile::Helper.require_valid_type(current_url, String)
|
81
|
+
|
82
|
+
@css_parser = CssParser::Parser.new
|
83
|
+
if css_or_hp.is_a?(String)
|
84
|
+
@css_parser.load_string!(css_or_hp)
|
85
|
+
else
|
86
|
+
load_stylesheets(css_or_hp, current_url)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# @see Hatemile::Util::Css::StyleSheetParser#get_rules
|
92
|
+
def get_rules(properties = nil)
|
93
|
+
rules = []
|
94
|
+
@css_parser.each_rule_set do |rule|
|
95
|
+
auxiliar_rule = RCPRule.new(rule)
|
96
|
+
|
97
|
+
if properties.nil?
|
98
|
+
rules.push(auxiliar_rule)
|
99
|
+
next
|
100
|
+
end
|
101
|
+
|
102
|
+
properties.each do |property_name|
|
103
|
+
if auxiliar_rule.has_property?(property_name)
|
104
|
+
rules.push(auxiliar_rule)
|
105
|
+
break
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
rules
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
# you may not use this file except in compliance with the License.
|
3
|
+
# You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
require File.join(
|
14
|
+
File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))),
|
15
|
+
'helper'
|
16
|
+
)
|
17
|
+
require File.join(File.dirname(File.dirname(__FILE__)), 'style_sheet_rule')
|
18
|
+
require File.join(File.dirname(__FILE__), 'rcp_declaration')
|
19
|
+
|
20
|
+
##
|
21
|
+
# The Hatemile module contains the interfaces with the acessibility solutions.
|
22
|
+
module Hatemile
|
23
|
+
##
|
24
|
+
# The Hatemile::Util module contains the utilities of library.
|
25
|
+
module Util
|
26
|
+
##
|
27
|
+
# The Hatemile::Util::Css module contains the interfaces of CSS handles.
|
28
|
+
module Css
|
29
|
+
##
|
30
|
+
# The Hatemile::Util::Css::Rcp module contains the implementation of CSS
|
31
|
+
# handles for Ruby CSS Parser library.
|
32
|
+
module Rcp
|
33
|
+
##
|
34
|
+
# The RCPRule class is official implementation of
|
35
|
+
# Hatemile::Util::Css::StyleSheetRule for Ruby CSS Parser.
|
36
|
+
class RCPRule < Hatemile::Util::Css::StyleSheetRule
|
37
|
+
public_class_method :new
|
38
|
+
|
39
|
+
##
|
40
|
+
# Initializes a new object that encapsulate the Ruby CSS Parser rule.
|
41
|
+
#
|
42
|
+
# @param rule [CssParser::RuleSet] The Ruby CSS Parser rule.
|
43
|
+
def initialize(rule)
|
44
|
+
Hatemile::Helper.require_not_nil(rule)
|
45
|
+
Hatemile::Helper.require_valid_type(rule, CssParser::RuleSet)
|
46
|
+
|
47
|
+
@rule = rule
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# @see Hatemile::Util::Css::StyleSheetRule#has_property?
|
52
|
+
def has_property?(property_name)
|
53
|
+
@rule.each_declaration do |property, _value, _important|
|
54
|
+
return true if property == property_name
|
55
|
+
end
|
56
|
+
false
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# @see Hatemile::Util::Css::StyleSheetRule#has_declarations?
|
61
|
+
def has_declarations?
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# @see Hatemile::Util::Css::StyleSheetRule#get_declarations
|
67
|
+
def get_declarations(property_name)
|
68
|
+
declarations = []
|
69
|
+
@rule.each_declaration do |property, value, _important|
|
70
|
+
if property == property_name
|
71
|
+
declarations.push(RCPDeclaration.new(property, value))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
declarations
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# @see Hatemile::Util::Css::StyleSheetRule#get_selector
|
79
|
+
def get_selector
|
80
|
+
@rule.selectors.join(', ')
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|