capybara-accessible 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/README.md +23 -5
- data/Rakefile +9 -2
- data/capybara-accessible.gemspec +2 -2
- data/lib/capybara/accessible/auditor.rb +20 -3
- data/lib/capybara/accessible/version.rb +1 -1
- data/spec/driver_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- data/tddium.yml +7 -0
- metadata +11 -15
- data/Gemfile.lock +0 -69
- data/lib/capybara/accessible/axs_testing.js +0 -1140
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45bcc68360537a9bf88941fdb14394b186601865
|
4
|
+
data.tar.gz: de04b15c11841686693a6f0fb6c997d5a7cbdde9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 764e074dc858a16d53e7e62c57024c41fa418b0cddca28841407147ccb2a78d83181b107d9b8dac01025183af1a3592e4b2ccec535ae60dafa24c75dea65e836
|
7
|
+
data.tar.gz: 1bbef963dec6de593688ee6d52210f7f8488c7cb2db07295eeefd107dcc3554e3320feb29f05587df6a98a5df3976a1808f306d6e66faaab6f03353bd40e4b03
|
data/.gitignore
CHANGED
data/.gitmodules
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/README.md
CHANGED
@@ -30,6 +30,8 @@ This way you do not need to make explicit assertions on accessibility. Instead,
|
|
30
30
|
|
31
31
|
Need help? Ask on the mailing list (please do not open an issue on GitHub): https://groups.google.com/forum/#!forum/capybara-accessible
|
32
32
|
|
33
|
+
Visit the [wiki](https://github.com/Casecommons/capybara-accessible/wiki) for more background on automated accessibility testing with capybara-accessible.
|
34
|
+
|
33
35
|
## Installation
|
34
36
|
|
35
37
|
Add this line to your application's Gemfile:
|
@@ -51,18 +53,34 @@ You can use capybara-accessible as a drop-in replacement for Rack::Test, Seleniu
|
|
51
53
|
require 'capybara/rspec'
|
52
54
|
require 'capybara/accessible'
|
53
55
|
|
54
|
-
Capybara.
|
56
|
+
Capybara.default_driver = :accessible
|
57
|
+
|
58
|
+
### Disabling audits
|
59
|
+
You can disable audits on individual tests by tagging the example or group as `inaccessible: true`, and configuring Rspec like so:
|
55
60
|
|
56
|
-
|
61
|
+
# spec/spec_helper.rb
|
57
62
|
|
58
|
-
|
63
|
+
RSpec.configure do |config|
|
64
|
+
config.around(:each, :inaccessible => true) do |example|
|
65
|
+
Capybara::Accessible.skip_audit { example.run }
|
66
|
+
end
|
67
|
+
end
|
59
68
|
|
60
|
-
You can use exclusions to supress failures for accessibility errors that you cannot immediately address, without turning off all assertions.
|
61
69
|
|
62
|
-
|
70
|
+
# spec/features/inaccessible_page_spec.rb
|
71
|
+
|
72
|
+
# Blocks tagged inaccessible will skip accessibility assertions.
|
73
|
+
# They will still run your other native assertions.
|
74
|
+
describe '/inaccessible', inaccessible: true do
|
75
|
+
it 'display an image' do
|
76
|
+
page.should have_css 'img'
|
77
|
+
end
|
78
|
+
end
|
63
79
|
|
64
80
|
## Contributing
|
65
81
|
|
82
|
+
NOTE: axs_testing.js is automatically generated by Google's Accessibility Developer tools project. If you want to modify the audit rules, please contribute to the Google project: https://github.com/GoogleChrome/accessibility-developer-tools
|
83
|
+
|
66
84
|
1. Fork it
|
67
85
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
86
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
data/Rakefile
CHANGED
@@ -8,5 +8,12 @@ RSpec::Core::RakeTask.new do |t|
|
|
8
8
|
t.rspec_opts = "--format progress"
|
9
9
|
end
|
10
10
|
|
11
|
-
desc "Default:
|
12
|
-
task :default => [:
|
11
|
+
desc "Default: run all specs"
|
12
|
+
task :default => [:spec]
|
13
|
+
|
14
|
+
desc "Build: fetch and compile javascript assertions project"
|
15
|
+
task :build do
|
16
|
+
system "git submodule init && git submodule update"
|
17
|
+
system "cd ./vendor/accessibility-developer-tools/ && make js"
|
18
|
+
system "gem build capybara-accessible.gemspec"
|
19
|
+
end
|
data/capybara-accessible.gemspec
CHANGED
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency("capybara"
|
21
|
+
spec.add_dependency("capybara")
|
22
22
|
spec.add_dependency("selenium-webdriver")
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
-
spec.add_development_dependency "rake"
|
26
25
|
spec.add_development_dependency "rspec"
|
27
26
|
spec.add_development_dependency "pry"
|
27
|
+
spec.add_development_dependency "tddium"
|
28
28
|
|
29
29
|
# Sinatra is used by Capybara's TestApp
|
30
30
|
spec.add_development_dependency("sinatra")
|
@@ -1,6 +1,15 @@
|
|
1
1
|
module Capybara::Accessible
|
2
2
|
class InaccessibleError < Capybara::CapybaraError; end
|
3
3
|
|
4
|
+
class << self
|
5
|
+
def skip_audit
|
6
|
+
@disabled = true
|
7
|
+
yield
|
8
|
+
ensure
|
9
|
+
@disabled = false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
module Auditor
|
5
14
|
def self.exclusions=(rules)
|
6
15
|
@@exclusions = rules
|
@@ -11,15 +20,19 @@ module Capybara::Accessible
|
|
11
20
|
end
|
12
21
|
|
13
22
|
def audit_rules
|
14
|
-
File.read(File.expand_path("
|
23
|
+
File.read(File.expand_path("../../../../vendor/accessibility-developer-tools/gen/axs_testing.js", __FILE__))
|
15
24
|
end
|
16
25
|
|
17
26
|
def audit_failures
|
18
|
-
|
27
|
+
if Capybara::Accessible.instance_variable_get(:@disabled)
|
28
|
+
[]
|
29
|
+
else
|
30
|
+
run_script("#{perform_audit_script} return axs.Audit.auditResults(results).getErrors();")
|
31
|
+
end
|
19
32
|
end
|
20
33
|
|
21
34
|
def failure_messages
|
22
|
-
run_script("#{perform_audit_script} return axs.Audit.createReport(results)")
|
35
|
+
"Found at #{page_url} \n\n" + run_script("#{perform_audit_script} return axs.Audit.createReport(results)")
|
23
36
|
end
|
24
37
|
|
25
38
|
private
|
@@ -56,6 +69,10 @@ module Capybara::Accessible
|
|
56
69
|
codes.map { |code| mapping[code]}
|
57
70
|
end
|
58
71
|
|
72
|
+
def page_url
|
73
|
+
@session ? @session.driver.current_url : current_url
|
74
|
+
end
|
75
|
+
|
59
76
|
def run_script(script)
|
60
77
|
if @session
|
61
78
|
@session.driver.execute_script(script)
|
data/spec/driver_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe Capybara::Accessible::Driver do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'does not raise an error on an excluded rule' do
|
30
|
-
expect { @session.visit('/excluded') }.to_not raise_error
|
30
|
+
expect { @session.visit('/excluded') }.to_not raise_error
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -12,6 +12,9 @@ $LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
|
|
12
12
|
|
13
13
|
RSpec.configure do |c|
|
14
14
|
Capybara::SpecHelper.configure(c)
|
15
|
+
c.around(:each, :inaccessible => true) do |example|
|
16
|
+
Capybara::Accessible.skip_audit { example.run }
|
17
|
+
end
|
15
18
|
end
|
16
19
|
|
17
20
|
Capybara.current_driver = :accessible
|
data/tddium.yml
ADDED
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-accessible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Case Commons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
17
|
- - '>='
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: '0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '2.0'
|
30
24
|
- - '>='
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: '0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: selenium-webdriver
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +53,7 @@ dependencies:
|
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '1.3'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
56
|
+
name: rspec
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
59
|
- - '>='
|
@@ -73,7 +67,7 @@ dependencies:
|
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: '0'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
70
|
+
name: pry
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
73
|
- - '>='
|
@@ -87,7 +81,7 @@ dependencies:
|
|
87
81
|
- !ruby/object:Gem::Version
|
88
82
|
version: '0'
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
84
|
+
name: tddium
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
92
86
|
requirements:
|
93
87
|
- - '>='
|
@@ -122,21 +116,22 @@ extensions: []
|
|
122
116
|
extra_rdoc_files: []
|
123
117
|
files:
|
124
118
|
- .gitignore
|
119
|
+
- .gitmodules
|
120
|
+
- .rspec
|
125
121
|
- Gemfile
|
126
|
-
- Gemfile.lock
|
127
122
|
- LICENSE.txt
|
128
123
|
- README.md
|
129
124
|
- Rakefile
|
130
125
|
- capybara-accessible.gemspec
|
131
126
|
- lib/capybara/accessible.rb
|
132
127
|
- lib/capybara/accessible/auditor.rb
|
133
|
-
- lib/capybara/accessible/axs_testing.js
|
134
128
|
- lib/capybara/accessible/driver.rb
|
135
129
|
- lib/capybara/accessible/element.rb
|
136
130
|
- lib/capybara/accessible/version.rb
|
137
131
|
- spec/accessible_app.rb
|
138
132
|
- spec/driver_spec.rb
|
139
133
|
- spec/spec_helper.rb
|
134
|
+
- tddium.yml
|
140
135
|
- travis.yml
|
141
136
|
homepage: https://github.com/Casecommons/capybara-accessible
|
142
137
|
licenses:
|
@@ -167,3 +162,4 @@ test_files:
|
|
167
162
|
- spec/accessible_app.rb
|
168
163
|
- spec/driver_spec.rb
|
169
164
|
- spec/spec_helper.rb
|
165
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
capybara-accessible (0.1.0)
|
5
|
-
capybara (~> 2.0, >= 2.0.2)
|
6
|
-
selenium-webdriver
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
capybara (2.1.0)
|
12
|
-
mime-types (>= 1.16)
|
13
|
-
nokogiri (>= 1.3.3)
|
14
|
-
rack (>= 1.0.0)
|
15
|
-
rack-test (>= 0.5.4)
|
16
|
-
xpath (~> 2.0)
|
17
|
-
childprocess (0.3.9)
|
18
|
-
ffi (~> 1.0, >= 1.0.11)
|
19
|
-
coderay (1.0.9)
|
20
|
-
diff-lcs (1.2.4)
|
21
|
-
ffi (1.8.1)
|
22
|
-
method_source (0.8.1)
|
23
|
-
mime-types (1.23)
|
24
|
-
multi_json (1.7.7)
|
25
|
-
nokogiri (1.5.9)
|
26
|
-
pry (0.9.12.2)
|
27
|
-
coderay (~> 1.0.5)
|
28
|
-
method_source (~> 0.8)
|
29
|
-
slop (~> 3.4)
|
30
|
-
rack (1.4.5)
|
31
|
-
rack-protection (1.4.0)
|
32
|
-
rack
|
33
|
-
rack-test (0.6.2)
|
34
|
-
rack (>= 1.0)
|
35
|
-
rake (10.0.4)
|
36
|
-
rspec (2.13.0)
|
37
|
-
rspec-core (~> 2.13.0)
|
38
|
-
rspec-expectations (~> 2.13.0)
|
39
|
-
rspec-mocks (~> 2.13.0)
|
40
|
-
rspec-core (2.13.1)
|
41
|
-
rspec-expectations (2.13.0)
|
42
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
43
|
-
rspec-mocks (2.13.1)
|
44
|
-
rubyzip (0.9.9)
|
45
|
-
selenium-webdriver (2.32.1)
|
46
|
-
childprocess (>= 0.2.5)
|
47
|
-
multi_json (~> 1.0)
|
48
|
-
rubyzip
|
49
|
-
websocket (~> 1.0.4)
|
50
|
-
sinatra (1.3.6)
|
51
|
-
rack (~> 1.4)
|
52
|
-
rack-protection (~> 1.3)
|
53
|
-
tilt (~> 1.3, >= 1.3.3)
|
54
|
-
slop (3.4.5)
|
55
|
-
tilt (1.4.1)
|
56
|
-
websocket (1.0.7)
|
57
|
-
xpath (2.0.0)
|
58
|
-
nokogiri (~> 1.3)
|
59
|
-
|
60
|
-
PLATFORMS
|
61
|
-
ruby
|
62
|
-
|
63
|
-
DEPENDENCIES
|
64
|
-
bundler (~> 1.3)
|
65
|
-
capybara-accessible!
|
66
|
-
pry
|
67
|
-
rake
|
68
|
-
rspec
|
69
|
-
sinatra
|
@@ -1,1140 +0,0 @@
|
|
1
|
-
var COMPILED = !0, goog = goog || {};
|
2
|
-
goog.global = this;
|
3
|
-
goog.exportPath_ = function(a, b, c) {
|
4
|
-
a = a.split(".");
|
5
|
-
c = c || goog.global;
|
6
|
-
a[0] in c || !c.execScript || c.execScript("var " + a[0]);
|
7
|
-
for(var d;a.length && (d = a.shift());) {
|
8
|
-
a.length || void 0 === b ? c = c[d] ? c[d] : c[d] = {} : c[d] = b
|
9
|
-
}
|
10
|
-
};
|
11
|
-
goog.define = function(a, b) {
|
12
|
-
var c = b;
|
13
|
-
COMPILED || goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a]);
|
14
|
-
goog.exportPath_(a, c)
|
15
|
-
};
|
16
|
-
goog.DEBUG = !0;
|
17
|
-
goog.LOCALE = "en";
|
18
|
-
goog.TRUSTED_SITE = !0;
|
19
|
-
goog.provide = function(a) {
|
20
|
-
if(!COMPILED) {
|
21
|
-
if(goog.isProvided_(a)) {
|
22
|
-
throw Error('Namespace "' + a + '" already declared.');
|
23
|
-
}
|
24
|
-
delete goog.implicitNamespaces_[a];
|
25
|
-
for(var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectByName(b);) {
|
26
|
-
goog.implicitNamespaces_[b] = !0
|
27
|
-
}
|
28
|
-
}
|
29
|
-
goog.exportPath_(a)
|
30
|
-
};
|
31
|
-
goog.setTestOnly = function(a) {
|
32
|
-
if(COMPILED && !goog.DEBUG) {
|
33
|
-
throw a = a || "", Error("Importing test-only code into non-debug environment" + a ? ": " + a : ".");
|
34
|
-
}
|
35
|
-
};
|
36
|
-
COMPILED || (goog.isProvided_ = function(a) {
|
37
|
-
return!goog.implicitNamespaces_[a] && !!goog.getObjectByName(a)
|
38
|
-
}, goog.implicitNamespaces_ = {});
|
39
|
-
goog.getObjectByName = function(a, b) {
|
40
|
-
for(var c = a.split("."), d = b || goog.global, e;e = c.shift();) {
|
41
|
-
if(goog.isDefAndNotNull(d[e])) {
|
42
|
-
d = d[e]
|
43
|
-
}else {
|
44
|
-
return null
|
45
|
-
}
|
46
|
-
}
|
47
|
-
return d
|
48
|
-
};
|
49
|
-
goog.globalize = function(a, b) {
|
50
|
-
var c = b || goog.global, d;
|
51
|
-
for(d in a) {
|
52
|
-
c[d] = a[d]
|
53
|
-
}
|
54
|
-
};
|
55
|
-
goog.addDependency = function(a, b, c) {
|
56
|
-
if(goog.DEPENDENCIES_ENABLED) {
|
57
|
-
var d;
|
58
|
-
a = a.replace(/\\/g, "/");
|
59
|
-
for(var e = goog.dependencies_, f = 0;d = b[f];f++) {
|
60
|
-
e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.pathToNames[a][d] = !0
|
61
|
-
}
|
62
|
-
for(d = 0;b = c[d];d++) {
|
63
|
-
a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0
|
64
|
-
}
|
65
|
-
}
|
66
|
-
};
|
67
|
-
goog.ENABLE_DEBUG_LOADER = !0;
|
68
|
-
goog.require = function(a) {
|
69
|
-
if(!COMPILED && !goog.isProvided_(a)) {
|
70
|
-
if(goog.ENABLE_DEBUG_LOADER) {
|
71
|
-
var b = goog.getPathFromDeps_(a);
|
72
|
-
if(b) {
|
73
|
-
goog.included_[b] = !0;
|
74
|
-
goog.writeScripts_();
|
75
|
-
return
|
76
|
-
}
|
77
|
-
}
|
78
|
-
a = "goog.require could not find: " + a;
|
79
|
-
goog.global.console && goog.global.console.error(a);
|
80
|
-
throw Error(a);
|
81
|
-
}
|
82
|
-
};
|
83
|
-
goog.basePath = "";
|
84
|
-
goog.nullFunction = function() {
|
85
|
-
};
|
86
|
-
goog.identityFunction = function(a, b) {
|
87
|
-
return a
|
88
|
-
};
|
89
|
-
goog.abstractMethod = function() {
|
90
|
-
throw Error("unimplemented abstract method");
|
91
|
-
};
|
92
|
-
goog.addSingletonGetter = function(a) {
|
93
|
-
a.getInstance = function() {
|
94
|
-
if(a.instance_) {
|
95
|
-
return a.instance_
|
96
|
-
}
|
97
|
-
goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);
|
98
|
-
return a.instance_ = new a
|
99
|
-
}
|
100
|
-
};
|
101
|
-
goog.instantiatedSingletons_ = [];
|
102
|
-
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
|
103
|
-
goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function() {
|
104
|
-
var a = goog.global.document;
|
105
|
-
return"undefined" != typeof a && "write" in a
|
106
|
-
}, goog.findBasePath_ = function() {
|
107
|
-
if(goog.global.CLOSURE_BASE_PATH) {
|
108
|
-
goog.basePath = goog.global.CLOSURE_BASE_PATH
|
109
|
-
}else {
|
110
|
-
if(goog.inHtmlDocument_()) {
|
111
|
-
for(var a = goog.global.document.getElementsByTagName("script"), b = a.length - 1;0 <= b;--b) {
|
112
|
-
var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d;
|
113
|
-
if("base.js" == c.substr(d - 7, 7)) {
|
114
|
-
goog.basePath = c.substr(0, d - 7);
|
115
|
-
break
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}, goog.importScript_ = function(a) {
|
121
|
-
var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
|
122
|
-
!goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0)
|
123
|
-
}, goog.writeScriptTag_ = function(a) {
|
124
|
-
if(goog.inHtmlDocument_()) {
|
125
|
-
var b = goog.global.document;
|
126
|
-
if("complete" == b.readyState) {
|
127
|
-
if(/\bdeps.js$/.test(a)) {
|
128
|
-
return!1
|
129
|
-
}
|
130
|
-
throw Error('Cannot write "' + a + '" after document load');
|
131
|
-
}
|
132
|
-
b.write('<script type="text/javascript" src="' + a + '">\x3c/script>');
|
133
|
-
return!0
|
134
|
-
}
|
135
|
-
return!1
|
136
|
-
}, goog.writeScripts_ = function() {
|
137
|
-
function a(e) {
|
138
|
-
if(!(e in d.written)) {
|
139
|
-
if(!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) {
|
140
|
-
for(var g in d.requires[e]) {
|
141
|
-
if(!goog.isProvided_(g)) {
|
142
|
-
if(g in d.nameToPath) {
|
143
|
-
a(d.nameToPath[g])
|
144
|
-
}else {
|
145
|
-
throw Error("Undefined nameToPath for " + g);
|
146
|
-
}
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
e in c || (c[e] = !0, b.push(e))
|
151
|
-
}
|
152
|
-
}
|
153
|
-
var b = [], c = {}, d = goog.dependencies_, e;
|
154
|
-
for(e in goog.included_) {
|
155
|
-
d.written[e] || a(e)
|
156
|
-
}
|
157
|
-
for(e = 0;e < b.length;e++) {
|
158
|
-
if(b[e]) {
|
159
|
-
goog.importScript_(goog.basePath + b[e])
|
160
|
-
}else {
|
161
|
-
throw Error("Undefined script input");
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}, goog.getPathFromDeps_ = function(a) {
|
165
|
-
return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null
|
166
|
-
}, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js"));
|
167
|
-
goog.typeOf = function(a) {
|
168
|
-
var b = typeof a;
|
169
|
-
if("object" == b) {
|
170
|
-
if(a) {
|
171
|
-
if(a instanceof Array) {
|
172
|
-
return"array"
|
173
|
-
}
|
174
|
-
if(a instanceof Object) {
|
175
|
-
return b
|
176
|
-
}
|
177
|
-
var c = Object.prototype.toString.call(a);
|
178
|
-
if("[object Window]" == c) {
|
179
|
-
return"object"
|
180
|
-
}
|
181
|
-
if("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) {
|
182
|
-
return"array"
|
183
|
-
}
|
184
|
-
if("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) {
|
185
|
-
return"function"
|
186
|
-
}
|
187
|
-
}else {
|
188
|
-
return"null"
|
189
|
-
}
|
190
|
-
}else {
|
191
|
-
if("function" == b && "undefined" == typeof a.call) {
|
192
|
-
return"object"
|
193
|
-
}
|
194
|
-
}
|
195
|
-
return b
|
196
|
-
};
|
197
|
-
goog.isDef = function(a) {
|
198
|
-
return void 0 !== a
|
199
|
-
};
|
200
|
-
goog.isNull = function(a) {
|
201
|
-
return null === a
|
202
|
-
};
|
203
|
-
goog.isDefAndNotNull = function(a) {
|
204
|
-
return null != a
|
205
|
-
};
|
206
|
-
goog.isArray = function(a) {
|
207
|
-
return"array" == goog.typeOf(a)
|
208
|
-
};
|
209
|
-
goog.isArrayLike = function(a) {
|
210
|
-
var b = goog.typeOf(a);
|
211
|
-
return"array" == b || "object" == b && "number" == typeof a.length
|
212
|
-
};
|
213
|
-
goog.isDateLike = function(a) {
|
214
|
-
return goog.isObject(a) && "function" == typeof a.getFullYear
|
215
|
-
};
|
216
|
-
goog.isString = function(a) {
|
217
|
-
return"string" == typeof a
|
218
|
-
};
|
219
|
-
goog.isBoolean = function(a) {
|
220
|
-
return"boolean" == typeof a
|
221
|
-
};
|
222
|
-
goog.isNumber = function(a) {
|
223
|
-
return"number" == typeof a
|
224
|
-
};
|
225
|
-
goog.isFunction = function(a) {
|
226
|
-
return"function" == goog.typeOf(a)
|
227
|
-
};
|
228
|
-
goog.isObject = function(a) {
|
229
|
-
var b = typeof a;
|
230
|
-
return"object" == b && null != a || "function" == b
|
231
|
-
};
|
232
|
-
goog.getUid = function(a) {
|
233
|
-
return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_)
|
234
|
-
};
|
235
|
-
goog.removeUid = function(a) {
|
236
|
-
"removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);
|
237
|
-
try {
|
238
|
-
delete a[goog.UID_PROPERTY_]
|
239
|
-
}catch(b) {
|
240
|
-
}
|
241
|
-
};
|
242
|
-
goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0);
|
243
|
-
goog.uidCounter_ = 0;
|
244
|
-
goog.getHashCode = goog.getUid;
|
245
|
-
goog.removeHashCode = goog.removeUid;
|
246
|
-
goog.cloneObject = function(a) {
|
247
|
-
var b = goog.typeOf(a);
|
248
|
-
if("object" == b || "array" == b) {
|
249
|
-
if(a.clone) {
|
250
|
-
return a.clone()
|
251
|
-
}
|
252
|
-
var b = "array" == b ? [] : {}, c;
|
253
|
-
for(c in a) {
|
254
|
-
b[c] = goog.cloneObject(a[c])
|
255
|
-
}
|
256
|
-
return b
|
257
|
-
}
|
258
|
-
return a
|
259
|
-
};
|
260
|
-
goog.bindNative_ = function(a, b, c) {
|
261
|
-
return a.call.apply(a.bind, arguments)
|
262
|
-
};
|
263
|
-
goog.bindJs_ = function(a, b, c) {
|
264
|
-
if(!a) {
|
265
|
-
throw Error();
|
266
|
-
}
|
267
|
-
if(2 < arguments.length) {
|
268
|
-
var d = Array.prototype.slice.call(arguments, 2);
|
269
|
-
return function() {
|
270
|
-
var c = Array.prototype.slice.call(arguments);
|
271
|
-
Array.prototype.unshift.apply(c, d);
|
272
|
-
return a.apply(b, c)
|
273
|
-
}
|
274
|
-
}
|
275
|
-
return function() {
|
276
|
-
return a.apply(b, arguments)
|
277
|
-
}
|
278
|
-
};
|
279
|
-
goog.bind = function(a, b, c) {
|
280
|
-
Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_;
|
281
|
-
return goog.bind.apply(null, arguments)
|
282
|
-
};
|
283
|
-
goog.partial = function(a, b) {
|
284
|
-
var c = Array.prototype.slice.call(arguments, 1);
|
285
|
-
return function() {
|
286
|
-
var b = Array.prototype.slice.call(arguments);
|
287
|
-
b.unshift.apply(b, c);
|
288
|
-
return a.apply(this, b)
|
289
|
-
}
|
290
|
-
};
|
291
|
-
goog.mixin = function(a, b) {
|
292
|
-
for(var c in b) {
|
293
|
-
a[c] = b[c]
|
294
|
-
}
|
295
|
-
};
|
296
|
-
goog.now = goog.TRUSTED_SITE && Date.now || function() {
|
297
|
-
return+new Date
|
298
|
-
};
|
299
|
-
goog.globalEval = function(a) {
|
300
|
-
if(goog.global.execScript) {
|
301
|
-
goog.global.execScript(a, "JavaScript")
|
302
|
-
}else {
|
303
|
-
if(goog.global.eval) {
|
304
|
-
if(null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalWorksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobals_) {
|
305
|
-
goog.global.eval(a)
|
306
|
-
}else {
|
307
|
-
var b = goog.global.document, c = b.createElement("script");
|
308
|
-
c.type = "text/javascript";
|
309
|
-
c.defer = !1;
|
310
|
-
c.appendChild(b.createTextNode(a));
|
311
|
-
b.body.appendChild(c);
|
312
|
-
b.body.removeChild(c)
|
313
|
-
}
|
314
|
-
}else {
|
315
|
-
throw Error("goog.globalEval not available");
|
316
|
-
}
|
317
|
-
}
|
318
|
-
};
|
319
|
-
goog.evalWorksForGlobals_ = null;
|
320
|
-
goog.getCssName = function(a, b) {
|
321
|
-
var c = function(a) {
|
322
|
-
return goog.cssNameMapping_[a] || a
|
323
|
-
}, d = function(a) {
|
324
|
-
a = a.split("-");
|
325
|
-
for(var b = [], d = 0;d < a.length;d++) {
|
326
|
-
b.push(c(a[d]))
|
327
|
-
}
|
328
|
-
return b.join("-")
|
329
|
-
}, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) {
|
330
|
-
return a
|
331
|
-
};
|
332
|
-
return b ? a + "-" + d(b) : d(a)
|
333
|
-
};
|
334
|
-
goog.setCssNameMapping = function(a, b) {
|
335
|
-
goog.cssNameMapping_ = a;
|
336
|
-
goog.cssNameMappingStyle_ = b
|
337
|
-
};
|
338
|
-
!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);
|
339
|
-
goog.getMsg = function(a, b) {
|
340
|
-
var c = b || {}, d;
|
341
|
-
for(d in c) {
|
342
|
-
var e = ("" + c[d]).replace(/\$/g, "$$$$");
|
343
|
-
a = a.replace(RegExp("\\{\\$" + d + "\\}", "gi"), e)
|
344
|
-
}
|
345
|
-
return a
|
346
|
-
};
|
347
|
-
goog.getMsgWithFallback = function(a, b) {
|
348
|
-
return a
|
349
|
-
};
|
350
|
-
goog.exportSymbol = function(a, b, c) {
|
351
|
-
goog.exportPath_(a, b, c)
|
352
|
-
};
|
353
|
-
goog.exportProperty = function(a, b, c) {
|
354
|
-
a[b] = c
|
355
|
-
};
|
356
|
-
goog.inherits = function(a, b) {
|
357
|
-
function c() {
|
358
|
-
}
|
359
|
-
c.prototype = b.prototype;
|
360
|
-
a.superClass_ = b.prototype;
|
361
|
-
a.prototype = new c;
|
362
|
-
a.prototype.constructor = a
|
363
|
-
};
|
364
|
-
goog.base = function(a, b, c) {
|
365
|
-
var d = arguments.callee.caller;
|
366
|
-
if(goog.DEBUG && !d) {
|
367
|
-
throw Error("arguments.caller not defined. goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");
|
368
|
-
}
|
369
|
-
if(d.superClass_) {
|
370
|
-
return d.superClass_.constructor.apply(a, Array.prototype.slice.call(arguments, 1))
|
371
|
-
}
|
372
|
-
for(var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructor;g;g = g.superClass_ && g.superClass_.constructor) {
|
373
|
-
if(g.prototype[b] === d) {
|
374
|
-
f = !0
|
375
|
-
}else {
|
376
|
-
if(f) {
|
377
|
-
return g.prototype[b].apply(a, e)
|
378
|
-
}
|
379
|
-
}
|
380
|
-
}
|
381
|
-
if(a[b] === d) {
|
382
|
-
return a.constructor.prototype[b].apply(a, e)
|
383
|
-
}
|
384
|
-
throw Error("goog.base called from a method of one name to a method of a different name");
|
385
|
-
};
|
386
|
-
goog.scope = function(a) {
|
387
|
-
a.call(goog.global)
|
388
|
-
};
|
389
|
-
var axs = {};
|
390
|
-
axs.constants = {};
|
391
|
-
axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, alertdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, application:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{namefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"], parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-pressed"]}, checkbox:{namefrom:["contents",
|
392
|
-
"author"], namerequired:!0, parent:["input"], requiredProperties:["aria-checked"], properties:["aria-checked"]}, columnheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria-sort"]}, combobox:{mustcontain:["listbox", "textbox"], namefrom:["author"], namerequired:!0, parent:["select"], requiredProperties:["aria-expanded"], properties:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract":!0, namefrom:["author"],
|
393
|
-
parent:["widget"]}, complementary:{namefrom:["author"], parent:["landmark"]}, composite:{"abstract":!0, childpresentational:!1, namefrom:["author"], parent:["widget"], properties:["aria-activedescendant"]}, contentinfo:{namefrom:["author"], parent:["landmark"]}, definition:{namefrom:["author"], parent:["section"]}, dialog:{namefrom:["author"], namerequired:!0, parent:["window"]}, directory:{namefrom:["contents", "author"], parent:["list"]}, document:{namefrom:[" author"], namerequired:!0, parent:["structure"],
|
394
|
-
properties:["aria-expanded"]}, form:{namefrom:["author"], parent:["landmark"]}, grid:{mustcontain:["row", "rowgroup"], namefrom:["author"], namerequired:!0, parent:["composite", "region"], properties:["aria-level", "aria-multiselectable", "aria-readonly"]}, gridcell:{namefrom:["contents", "author"], namerequired:!0, parent:["section", "widget"], properties:["aria-readonly", "aria-required", "aria-selected"]}, group:{namefrom:[" author"], parent:["section"], properties:["aria-activedescendant"]},
|
395
|
-
heading:{namerequired:!0, parent:["sectionhead"], properties:["aria-level"]}, img:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["section"]}, input:{"abstract":!0, namefrom:["author"], parent:["widget"]}, landmark:{"abstract":!0, namefrom:["contents", "author"], namerequired:!1, parent:["region"]}, link:{namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded"]}, list:{mustcontain:["group", "listitem"], namefrom:["author"], parent:["region"]},
|
396
|
-
listbox:{mustcontain:["option"], namefrom:["author"], namerequired:!0, parent:["list", "select"], properties:["aria-multiselectable", "aria-required"]}, listitem:{namefrom:["contents", "author"], namerequired:!0, parent:["section"], properties:["aria-level", "aria-posinset", "aria-setsize"]}, log:{namefrom:[" author"], namerequired:!0, parent:["region"]}, main:{namefrom:["author"], parent:["landmark"]}, marquee:{namerequired:!0, parent:["section"]}, math:{childpresentational:!0, namefrom:["author"],
|
397
|
-
parent:["section"]}, menu:{mustcontain:["group", "menuitemradio", "menuitem", "menuitemcheckbox"], namefrom:["author"], namerequired:!0, parent:["list", "select"]}, menubar:{namefrom:["author"], parent:["menu"]}, menuitem:{namefrom:["contents", "author"], namerequired:!0, parent:["command"]}, menuitemcheckbox:{namefrom:["contents", "author"], namerequired:!0, parent:["checkbox", "menuitem"]}, menuitemradio:{namefrom:["contents", "author"], namerequired:!0, parent:["menuitemcheckbox", "radio"]}, navigation:{namefrom:["author"],
|
398
|
-
parent:["landmark"]}, note:{namefrom:["author"], parent:["section"]}, option:{namefrom:["contents", "author"], namerequired:!0, parent:["input"], properties:["aria-checked", "aria-posinset", "aria-selected", "aria-setsize"]}, presentation:{parent:["structure"]}, progressbar:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["range"]}, radio:{namefrom:["contents", "author"], namerequired:!0, parent:["checkbox", "option"]}, radiogroup:{mustcontain:["radio"], namefrom:["author"],
|
399
|
-
namerequired:!0, parent:["select"], properties:["aria-required"]}, range:{"abstract":!0, namefrom:["author"], parent:["widget"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"]}, region:{namefrom:[" author"], parent:["section"]}, roletype:{"abstract":!0, properties:"aria-atomic aria-busy aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-relevant".split(" ")},
|
400
|
-
row:{mustcontain:["columnheader", "gridcell", "rowheader"], namefrom:["contents", "author"], parent:["group", "widget"], properties:["aria-level", "aria-selected"]}, rowgroup:{mustcontain:["row"], namefrom:["contents", "author"], parent:["group"]}, rowheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria-sort"]}, search:{namefrom:["author"], parent:["landmark"]}, section:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"],
|
401
|
-
properties:["aria-expanded"]}, sectionhead:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"], properties:["aria-expanded"]}, select:{"abstract":!0, namefrom:["author"], parent:["composite", "group", "input"]}, separator:{childpresentational:!0, namefrom:["author"], parent:["structure"], properties:["aria-expanded", "aria-orientation"]}, scrollbar:{childpresentational:!0, namefrom:["author"], namerequired:!1, parent:["input", "range"], requiredProperties:["aria-controls", "aria-orientation",
|
402
|
-
"aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-controls", "aria-orientation", "aria-valuemax", "aria-valuemin", "aria-valuenow"]}, slider:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["input", "range"], requiredProperties:["aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-orientation"]}, spinbutton:{namefrom:["author"], namerequired:!0, parent:["input", "range"], requiredProperties:["aria-valuemax",
|
403
|
-
"aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-required"]}, status:{parent:["region"]}, structure:{"abstract":!0, parent:["roletype"]}, tab:{namefrom:["contents", "author"], parent:["sectionhead", "widget"], properties:["aria-selected"]}, tablist:{mustcontain:["tab"], namefrom:["author"], parent:["composite", "directory"], properties:["aria-level"]}, tabpanel:{namefrom:["author"], namerequired:!0, parent:["region"]}, textbox:{namefrom:["author"],
|
404
|
-
namerequired:!0, parent:["input"], properties:["aria-activedescendant", "aria-autocomplete", "aria-multiline", "aria-readonly", "aria-required"]}, timer:{namefrom:["author"], namerequired:!0, parent:["status"]}, toolbar:{namefrom:["author"], parent:["group"]}, tooltip:{namerequired:!0, parent:["section"]}, tree:{mustcontain:["group", "treeitem"], namefrom:["author"], namerequired:!0, parent:["select"], properties:["aria-multiselectable", "aria-required"]}, treegrid:{mustcontain:["row"], namefrom:["author"],
|
405
|
-
namerequired:!0, parent:["grid", "tree"]}, treeitem:{namefrom:["contents", "author"], namerequired:!0, parent:["listitem", "option"]}, widget:{"abstract":!0, parent:["roletype"]}, window:{"abstract":!0, namefrom:[" author"], parent:["roletype"], properties:["aria-expanded"]}};
|
406
|
-
axs.constants.WIDGET_ROLES = {};
|
407
|
-
axs.constants.addAllParentRolesToSet_ = function(a, b) {
|
408
|
-
if(a.parent) {
|
409
|
-
for(var c = a.parent, d = 0;d < c.length;d++) {
|
410
|
-
var e = c[d];
|
411
|
-
b[e] = !0;
|
412
|
-
axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b)
|
413
|
-
}
|
414
|
-
}
|
415
|
-
};
|
416
|
-
axs.constants.addAllPropertiesToSet_ = function(a, b, c) {
|
417
|
-
var d = a[b];
|
418
|
-
if(d) {
|
419
|
-
for(var e = 0;e < d.length;e++) {
|
420
|
-
c[d[e]] = !0
|
421
|
-
}
|
422
|
-
}
|
423
|
-
if(a.parent) {
|
424
|
-
for(a = a.parent, d = 0;d < a.length;d++) {
|
425
|
-
axs.constants.addAllPropertiesToSet_(axs.constants.ARIA_ROLES[a[d]], b, c)
|
426
|
-
}
|
427
|
-
}
|
428
|
-
};
|
429
|
-
for(var roleName in axs.constants.ARIA_ROLES) {
|
430
|
-
var role = axs.constants.ARIA_ROLES[roleName], propertiesSet = {};
|
431
|
-
axs.constants.addAllPropertiesToSet_(role, "properties", propertiesSet);
|
432
|
-
role.propertiesSet = propertiesSet;
|
433
|
-
var requiredPropertiesSet = {};
|
434
|
-
axs.constants.addAllPropertiesToSet_(role, "requiredProperties", requiredPropertiesSet);
|
435
|
-
role.requiredPropertiesSet = requiredPropertiesSet;
|
436
|
-
var parentRolesSet = {};
|
437
|
-
axs.constants.addAllParentRolesToSet_(role, parentRolesSet);
|
438
|
-
role.allParentRolesSet = parentRolesSet;
|
439
|
-
"widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role)
|
440
|
-
}
|
441
|
-
axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"idref"}, atomic:{defaultValue:"false", type:"property", valueType:"boolean"}, autocomplete:{defaultValue:"none", type:"property", valueType:"token", values:["inline", "list", "both", "none"]}, busy:{defaultValue:"false", type:"state", valueType:"boolean"}, checked:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "mixed", "undefined"]}, controls:{type:"property", valueType:"idref_list"},
|
442
|
-
describedby:{type:"property", valueType:"idref_list"}, disabled:{defaultValue:"false", type:"state", valueType:"boolean"}, dropeffect:{defaultValue:"none", type:"property", valueType:"token_list", values:"copy move link execute popup none".split(" ")}, expanded:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "undefined"]}, flowto:{type:"property", valueType:"idref_list"}, grabbed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false",
|
443
|
-
"undefined"]}, haspopup:{defaultValue:"false", type:"property", valueType:"boolean"}, hidden:{defaultValue:"false", type:"state", valueType:"boolean"}, invalid:{defaultValue:"false", type:"state", valueType:"token", values:["grammar", "false", "spelling", "true"]}, label:{type:"property", valueType:"string"}, labelledby:{type:"property", valueType:"idref_list"}, level:{type:"property", valueType:"integer"}, live:{defaultValue:"off", type:"property", valueType:"token", values:["off", "polite", "assertive"]},
|
444
|
-
multiline:{defaultValue:"false", type:"property", valueType:"boolean"}, multiselectable:{defaultValue:"false", type:"property", valueType:"boolean"}, orientation:{defaultValue:"vertical", type:"property", valueType:"token", values:["horizontal", "vertical"]}, owns:{type:"property", valueType:"idref_list"}, posinset:{type:"property", valueType:"integer"}, pressed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "mixed", "undefined"]}, readonly:{defaultValue:"false",
|
445
|
-
type:"property", valueType:"boolean"}, relevant:{defaultValue:"additions text", type:"property", valueType:"token_list", values:["additions", "removals", "text", "all"]}, required:{defaultValue:"false", type:"property", valueType:"boolean"}, selected:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "undefined"]}, setsize:{type:"property", valueType:"integer"}, sort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending", "descending", "none",
|
446
|
-
"other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"property", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, valuetext:{type:"property", valueType:"string"}};
|
447
|
-
axs.constants.GLOBAL_PROPERTIES = "aria-atomic aria-busy aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-relevant".split(" ");
|
448
|
-
axs.constants.NO_ROLE_NAME = " ";
|
449
|
-
axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", columnheader:"aria_role_columnheader", combobox:"aria_role_combobox", dialog:"aria_role_dialog", grid:"aria_role_grid", gridcell:"aria_role_gridcell", link:"aria_role_link", listbox:"aria_role_listbox", log:"aria_role_log", marquee:"aria_role_marquee", menu:"aria_role_menu", menubar:"aria_role_menubar", menuitem:"aria_role_menuitem", menuitemcheckbox:"aria_role_menuitemcheckbox",
|
450
|
-
menuitemradio:"aria_role_menuitemradio", option:axs.constants.NO_ROLE_NAME, progressbar:"aria_role_progressbar", radio:"aria_role_radio", radiogroup:"aria_role_radiogroup", rowheader:"aria_role_rowheader", scrollbar:"aria_role_scrollbar", slider:"aria_role_slider", spinbutton:"aria_role_spinbutton", status:"aria_role_status", tab:"aria_role_tab", tabpanel:"aria_role_tabpanel", textbox:"aria_role_textbox", timer:"aria_role_timer", toolbar:"aria_role_toolbar", tooltip:"aria_role_tooltip", treeitem:"aria_role_treeitem"};
|
451
|
-
axs.constants.STRUCTURE_ROLE_TO_NAME = {article:"aria_role_article", application:"aria_role_application", banner:"aria_role_banner", columnheader:"aria_role_columnheader", complementary:"aria_role_complementary", contentinfo:"aria_role_contentinfo", definition:"aria_role_definition", directory:"aria_role_directory", document:"aria_role_document", form:"aria_role_form", group:"aria_role_group", heading:"aria_role_heading", img:"aria_role_img", list:"aria_role_list", listitem:"aria_role_listitem",
|
452
|
-
main:"aria_role_main", math:"aria_role_math", navigation:"aria_role_navigation", note:"aria_role_note", region:"aria_role_region", rowheader:"aria_role_rowheader", search:"aria_role_search", separator:"aria_role_separator"};
|
453
|
-
axs.constants.ATTRIBUTE_VALUE_TO_STATUS = [{name:"aria-autocomplete", values:{inline:"aria_autocomplete_inline", list:"aria_autocomplete_list", both:"aria_autocomplete_both"}}, {name:"aria-checked", values:{"true":"aria_checked_true", "false":"aria_checked_false", mixed:"aria_checked_mixed"}}, {name:"aria-disabled", values:{"true":"aria_disabled_true"}}, {name:"aria-expanded", values:{"true":"aria_expanded_true", "false":"aria_expanded_false"}}, {name:"aria-invalid", values:{"true":"aria_invalid_true",
|
454
|
-
grammar:"aria_invalid_grammar", spelling:"aria_invalid_spelling"}}, {name:"aria-multiline", values:{"true":"aria_multiline_true"}}, {name:"aria-multiselectable", values:{"true":"aria_multiselectable_true"}}, {name:"aria-pressed", values:{"true":"aria_pressed_true", "false":"aria_pressed_false", mixed:"aria_pressed_mixed"}}, {name:"aria-readonly", values:{"true":"aria_readonly_true"}}, {name:"aria-required", values:{"true":"aria_required_true"}}, {name:"aria-selected", values:{"true":"aria_selected_true",
|
455
|
-
"false":"aria_selected_false"}}];
|
456
|
-
axs.constants.INPUT_TYPE_TO_INFORMATION_TABLE_MSG = {button:"input_type_button", checkbox:"input_type_checkbox", color:"input_type_color", datetime:"input_type_datetime", "datetime-local":"input_type_datetime_local", date:"input_type_date", email:"input_type_email", file:"input_type_file", image:"input_type_image", month:"input_type_month", number:"input_type_number", password:"input_type_password", radio:"input_type_radio", range:"input_type_range", reset:"input_type_reset", search:"input_type_search",
|
457
|
-
submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"input_type_url", week:"input_type_week"};
|
458
|
-
axs.constants.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG = {A:"tag_link", BUTTON:"tag_button", H1:"tag_h1", H2:"tag_h2", H3:"tag_h3", H4:"tag_h4", H5:"tag_h5", H6:"tag_h6", LI:"tag_li", OL:"tag_ol", SELECT:"tag_select", TEXTAREA:"tag_textarea", UL:"tag_ul", SECTION:"tag_section", NAV:"tag_nav", ARTICLE:"tag_article", ASIDE:"tag_aside", HGROUP:"tag_hgroup", HEADER:"tag_header", FOOTER:"tag_footer", TIME:"tag_time", MARK:"tag_mark"};
|
459
|
-
axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:"tag_select", TEXTAREA:"tag_textarea"};
|
460
|
-
axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0};
|
461
|
-
for(var propertyName in axs.constants.ARIA_PROPERTIES) {
|
462
|
-
var propertyDetails = axs.constants.ARIA_PROPERTIES[propertyName];
|
463
|
-
if(propertyDetails.values) {
|
464
|
-
for(var valuesSet = {}, i = 0;i < propertyDetails.values.length;i++) {
|
465
|
-
valuesSet[propertyDetails.values[i]] = !0
|
466
|
-
}
|
467
|
-
propertyDetails.valuesSet = valuesSet
|
468
|
-
}
|
469
|
-
}
|
470
|
-
axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"};
|
471
|
-
axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"};
|
472
|
-
axs.utils = {};
|
473
|
-
axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href],iframe,[tabindex]";
|
474
|
-
axs.utils.Color = function(a, b, c, d) {
|
475
|
-
this.red = a;
|
476
|
-
this.green = b;
|
477
|
-
this.blue = c;
|
478
|
-
this.alpha = d
|
479
|
-
};
|
480
|
-
axs.utils.calculateContrastRatio = function(a, b) {
|
481
|
-
if(!a || !b) {
|
482
|
-
return null
|
483
|
-
}
|
484
|
-
1 > a.alpha && (a = axs.utils.flattenColors(a, b));
|
485
|
-
var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b);
|
486
|
-
return(Math.max(c, d) + 0.05) / (Math.min(c, d) + 0.05)
|
487
|
-
};
|
488
|
-
axs.utils.elementIsTransparent = function(a) {
|
489
|
-
return"0" == a.style.opacity
|
490
|
-
};
|
491
|
-
axs.utils.elementHasZeroArea = function(a) {
|
492
|
-
a = a.getBoundingClientRect();
|
493
|
-
var b = a.top - a.bottom;
|
494
|
-
return a.right - a.left && b ? !1 : !0
|
495
|
-
};
|
496
|
-
axs.utils.elementIsOutsideScrollArea = function(a) {
|
497
|
-
a = a.getBoundingClientRect();
|
498
|
-
var b = document.body.scrollWidth, c = document.body.scrollTop, d = document.body.scrollLeft;
|
499
|
-
return a.top >= document.body.scrollHeight || a.bottom <= -c || a.left >= b || a.right <= -d ? !0 : !1
|
500
|
-
};
|
501
|
-
axs.utils.overlappingElement = function(a) {
|
502
|
-
function b(a, c) {
|
503
|
-
return null == c ? !1 : c === a ? !0 : b(a, c.parentNode)
|
504
|
-
}
|
505
|
-
if(axs.utils.elementHasZeroArea(a)) {
|
506
|
-
return null
|
507
|
-
}
|
508
|
-
var c = a.getBoundingClientRect(), c = document.elementFromPoint((c.left + c.right) / 2, (c.top + c.bottom) / 2);
|
509
|
-
return null == c || c == a || b(c, a) ? null : c
|
510
|
-
};
|
511
|
-
axs.utils.elementIsHtmlControl = function(a) {
|
512
|
-
var b = a.ownerDocument.defaultView;
|
513
|
-
return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement || a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1
|
514
|
-
};
|
515
|
-
axs.utils.elementIsAriaWidget = function(a) {
|
516
|
-
return a.hasAttribute("role") && (a = a.getAttribute("role")) && (a = axs.constants.ARIA_ROLES[a]) && "widget" in a.allParentRolesSet ? !0 : !1
|
517
|
-
};
|
518
|
-
axs.utils.elementIsVisible = function(a) {
|
519
|
-
if(axs.utils.elementIsTransparent(a) || axs.utils.elementHasZeroArea(a) || axs.utils.elementIsOutsideScrollArea(a)) {
|
520
|
-
return!1
|
521
|
-
}
|
522
|
-
if(a = axs.utils.overlappingElement(a)) {
|
523
|
-
var b = window.getComputedStyle(a, null);
|
524
|
-
if(b && (a = axs.utils.getBgColor(b, a)) && 0 < a.alpha) {
|
525
|
-
return!1
|
526
|
-
}
|
527
|
-
}
|
528
|
-
return!0
|
529
|
-
};
|
530
|
-
axs.utils.isLargeFont = function(a) {
|
531
|
-
var b = a.fontSize;
|
532
|
-
a = "bold" == a.fontWeight;
|
533
|
-
var c = b.match(/(\d+)px/);
|
534
|
-
if(c) {
|
535
|
-
return b = parseInt(c[1], 10), a && 19.2 <= b || 24 <= b ? !0 : !1
|
536
|
-
}
|
537
|
-
if(c = b.match(/(\d+)em/)) {
|
538
|
-
return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1
|
539
|
-
}
|
540
|
-
if(c = b.match(/(\d+)%/)) {
|
541
|
-
return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1
|
542
|
-
}
|
543
|
-
if(c = b.match(/(\d+)pt/)) {
|
544
|
-
if(b = parseInt(c[1], 10), a && 14 <= b || 14 <= b) {
|
545
|
-
return!0
|
546
|
-
}
|
547
|
-
}
|
548
|
-
return!1
|
549
|
-
};
|
550
|
-
axs.utils.getBgColor = function(a, b) {
|
551
|
-
var c = axs.utils.parseColor(a.backgroundColor);
|
552
|
-
if(!c || a.backgroundImage && "none" != a.backgroundImage) {
|
553
|
-
return null
|
554
|
-
}
|
555
|
-
if(1 > c.alpha) {
|
556
|
-
var d = b, e = [];
|
557
|
-
e.push(c);
|
558
|
-
for(c = null;d = d.parentElement;) {
|
559
|
-
var f = window.getComputedStyle(d, null);
|
560
|
-
if(f) {
|
561
|
-
if(f.backgroundImage && "none" != f.backgroundImage) {
|
562
|
-
return null
|
563
|
-
}
|
564
|
-
if((f = axs.utils.parseColor(f.backgroundColor)) && 0 != f.alpha && (e.push(f), 1 == f.alpha)) {
|
565
|
-
c = null;
|
566
|
-
break
|
567
|
-
}
|
568
|
-
}
|
569
|
-
}
|
570
|
-
c || e.push(new axs.utils.Color(255, 255, 255, 1));
|
571
|
-
for(d = e.pop();e.length;) {
|
572
|
-
c = e.pop(), d = axs.utils.flattenColors(c, d)
|
573
|
-
}
|
574
|
-
c = d
|
575
|
-
}
|
576
|
-
return c
|
577
|
-
};
|
578
|
-
axs.utils.getFgColor = function(a, b) {
|
579
|
-
var c = axs.utils.parseColor(a.color);
|
580
|
-
if(!c) {
|
581
|
-
return null
|
582
|
-
}
|
583
|
-
1 > c.alpha && (c = axs.utils.flattenColors(c, b));
|
584
|
-
return c
|
585
|
-
};
|
586
|
-
axs.utils.parseColor = function(a) {
|
587
|
-
var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/);
|
588
|
-
if(b) {
|
589
|
-
a = parseInt(b[1], 10);
|
590
|
-
var c = parseInt(b[2], 10), b = parseInt(b[3], 10), d;
|
591
|
-
return new axs.utils.Color(a, c, b, 1)
|
592
|
-
}
|
593
|
-
return(b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d+(\.\d+)?)\)/)) ? (d = parseInt(b[4], 10), a = parseInt(b[1], 10), c = parseInt(b[2], 10), b = parseInt(b[3], 10), new axs.utils.Color(a, c, b, d)) : null
|
594
|
-
};
|
595
|
-
axs.utils.colorToString = function(a) {
|
596
|
-
return"rgba(" + [a.red, a.green, a.blue, a.alpha].join() + ")"
|
597
|
-
};
|
598
|
-
axs.utils.flattenColors = function(a, b) {
|
599
|
-
var c = a.alpha;
|
600
|
-
return new axs.utils.Color((1 - c) * b.red + c * a.red, (1 - c) * b.green + c * a.green, (1 - c) * b.blue + c * a.blue, 1)
|
601
|
-
};
|
602
|
-
axs.utils.calculateLuminance = function(a) {
|
603
|
-
var b = a.red / 255, c = a.green / 255;
|
604
|
-
a = a.blue / 255;
|
605
|
-
b = 0.03928 >= b ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
|
606
|
-
c = 0.03928 >= c ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
607
|
-
a = 0.03928 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
608
|
-
return 0.2126 * b + 0.7152 * c + 0.0722 * a
|
609
|
-
};
|
610
|
-
axs.utils.getContrastRatioForElement = function(a) {
|
611
|
-
var b = window.getComputedStyle(a, null);
|
612
|
-
return axs.utils.getContrastRatioForElementWithComputedStyle(b, a)
|
613
|
-
};
|
614
|
-
axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) {
|
615
|
-
if(!axs.utils.elementIsVisible(b)) {
|
616
|
-
return null
|
617
|
-
}
|
618
|
-
var c = axs.utils.getBgColor(a, b);
|
619
|
-
if(!c) {
|
620
|
-
return null
|
621
|
-
}
|
622
|
-
var d = axs.utils.getFgColor(a, c);
|
623
|
-
return d ? axs.utils.calculateContrastRatio(d, c) : null
|
624
|
-
};
|
625
|
-
axs.utils.isNativeTextElement = function(a) {
|
626
|
-
var b = a.tagName.toLowerCase();
|
627
|
-
a = a.type ? a.type.toLowerCase() : "";
|
628
|
-
if("textarea" == b) {
|
629
|
-
return!0
|
630
|
-
}
|
631
|
-
if("input" != b) {
|
632
|
-
return!1
|
633
|
-
}
|
634
|
-
switch(a) {
|
635
|
-
case "email":
|
636
|
-
;
|
637
|
-
case "number":
|
638
|
-
;
|
639
|
-
case "password":
|
640
|
-
;
|
641
|
-
case "search":
|
642
|
-
;
|
643
|
-
case "text":
|
644
|
-
;
|
645
|
-
case "tel":
|
646
|
-
;
|
647
|
-
case "url":
|
648
|
-
;
|
649
|
-
case "":
|
650
|
-
return!0;
|
651
|
-
default:
|
652
|
-
return!1
|
653
|
-
}
|
654
|
-
};
|
655
|
-
axs.utils.isLowContrast = function(a, b) {
|
656
|
-
return 3 > a || !axs.utils.isLargeFont(b) && 4.5 > a
|
657
|
-
};
|
658
|
-
axs.utils.hasLabel = function(a) {
|
659
|
-
var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : "";
|
660
|
-
if(a.hasAttribute("aria-label") || a.hasAttribute("title") || "img" == b && a.hasAttribute("alt") || "input" == b && "image" == c && a.hasAttribute("alt") || "input" == b && ("submit" == c || "reset" == c) || a.hasAttribute("aria-labelledby") || axs.utils.isNativeTextElement(a) && a.hasAttribute("placeholder") || a.hasAttribute("id") && 0 < document.querySelectorAll("label[for=" + a.id + "]").length) {
|
661
|
-
return!0
|
662
|
-
}
|
663
|
-
for(b = a.parentElement;b;) {
|
664
|
-
if("label" == b.tagName.toLowerCase() && b.control == a) {
|
665
|
-
return!0
|
666
|
-
}
|
667
|
-
b = b.parentElement
|
668
|
-
}
|
669
|
-
return!1
|
670
|
-
};
|
671
|
-
axs.utils.isElementHidden = function(a) {
|
672
|
-
if(!(a instanceof a.ownerDocument.defaultView.HTMLElement)) {
|
673
|
-
return!1
|
674
|
-
}
|
675
|
-
if(a.hasAttribute("chromevoxignoreariahidden")) {
|
676
|
-
var b = !0
|
677
|
-
}
|
678
|
-
var c = window.getComputedStyle(a, null);
|
679
|
-
return"none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1
|
680
|
-
};
|
681
|
-
axs.utils.isElementOrAncestorHidden = function(a) {
|
682
|
-
return axs.utils.isElementHidden(a) ? !0 : a.parentElement ? axs.utils.isElementOrAncestorHidden(a.parentElement) : !1
|
683
|
-
};
|
684
|
-
axs.utils.getRole = function(a) {
|
685
|
-
if(!a.hasAttribute("role")) {
|
686
|
-
return!1
|
687
|
-
}
|
688
|
-
a = a.getAttribute("role");
|
689
|
-
return axs.constants.ARIA_ROLES[a] ? {name:a, details:axs.constants.ARIA_ROLES[a], valid:!0} : {name:a, valid:!1}
|
690
|
-
};
|
691
|
-
axs.utils.getAriaPropertyValue = function(a, b, c) {
|
692
|
-
var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {name:a, rawValue:b};
|
693
|
-
if(!e) {
|
694
|
-
return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property', d
|
695
|
-
}
|
696
|
-
e = e.valueType;
|
697
|
-
if(!e) {
|
698
|
-
return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property', d
|
699
|
-
}
|
700
|
-
switch(e) {
|
701
|
-
case "idref":
|
702
|
-
a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.reason, d.idref = a.idref;
|
703
|
-
case "idref_list":
|
704
|
-
a = b.split(/\s+/);
|
705
|
-
d.valid = !0;
|
706
|
-
for(b = 0;b < a.length;b++) {
|
707
|
-
e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.values ? d.values.push(e) : d.values = [e]
|
708
|
-
}
|
709
|
-
return d;
|
710
|
-
case "integer":
|
711
|
-
c = axs.utils.isValidNumber(b);
|
712
|
-
if(!c.valid) {
|
713
|
-
return d.valid = !1, d.reason = c.reason, d
|
714
|
-
}
|
715
|
-
Math.floor(c.value) != c.value ? (d.valid = !1, d.reason = "" + b + " is not a whole integer") : (d.valid = !0, d.value = c.value);
|
716
|
-
return d;
|
717
|
-
case "number":
|
718
|
-
c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.value);
|
719
|
-
case "string":
|
720
|
-
return d.valid = !0, d.value = b, d;
|
721
|
-
case "token":
|
722
|
-
return c = axs.utils.isValidTokenValue(a, b.toLowerCase()), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d;
|
723
|
-
case "token_list":
|
724
|
-
e = b.split(/\s+/);
|
725
|
-
d.valid = !0;
|
726
|
-
for(b = 0;b < e.length;b++) {
|
727
|
-
c = axs.utils.isValidTokenValue(a, e[b].toLowerCase()), c.valid || (d.valid = !1, d.reason ? (d.reason = [d.reason], d.reason.push(c.reason)) : (d.reason = c.reason, d.possibleValues = c.possibleValues)), d.values ? d.values.push(c.value) : d.values = [c.value]
|
728
|
-
}
|
729
|
-
return d;
|
730
|
-
case "tristate":
|
731
|
-
return c = axs.utils.isPossibleValue(b.toLowerCase(), axs.constants.MIXED_VALUES, a), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d;
|
732
|
-
case "boolean":
|
733
|
-
return c = axs.utils.isValidBoolean(b), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d
|
734
|
-
}
|
735
|
-
d.valid = !1;
|
736
|
-
d.reason = "Not a valid ARIA property";
|
737
|
-
return d
|
738
|
-
};
|
739
|
-
axs.utils.isValidTokenValue = function(a, b) {
|
740
|
-
var c = a.replace(/^aria-/, "");
|
741
|
-
return axs.utils.isPossibleValue(b, axs.constants.ARIA_PROPERTIES[c].valuesSet, a)
|
742
|
-
};
|
743
|
-
axs.utils.isPossibleValue = function(a, b, c) {
|
744
|
-
return b[a] ? {valid:!0, value:a} : {valid:!1, value:a, reason:'"' + a + '" is not a valid value for ' + c, possibleValues:Object.keys(b)}
|
745
|
-
};
|
746
|
-
axs.utils.isValidBoolean = function(a) {
|
747
|
-
try {
|
748
|
-
var b = JSON.parse(a)
|
749
|
-
}catch(c) {
|
750
|
-
b = ""
|
751
|
-
}
|
752
|
-
return"boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a true/false value'} : {valid:!0, value:b}
|
753
|
-
};
|
754
|
-
axs.utils.isValidIDRefValue = function(a, b) {
|
755
|
-
return b.ownerDocument.getElementById(a) ? {valid:!0, idref:a} : {valid:!1, idref:a, reason:'No element with ID "' + a + '"'}
|
756
|
-
};
|
757
|
-
axs.utils.isValidNumber = function(a) {
|
758
|
-
var b = JSON.parse(a);
|
759
|
-
return"number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a number'} : {valid:!0, value:b}
|
760
|
-
};
|
761
|
-
axs.utils.isElementImplicitlyFocusable = function(a) {
|
762
|
-
var b = a.ownerDocument.defaultView;
|
763
|
-
return a instanceof b.HTMLAnchorElement || a instanceof b.HTMLAreaElement ? a.hasAttribute("href") : a instanceof b.HTMLInputElement || a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement || a instanceof b.HTMLButtonElement || a instanceof b.HTMLIFrameElement ? !a.disabled : !1
|
764
|
-
};
|
765
|
-
axs.utils.values = function(a) {
|
766
|
-
var b = [], c;
|
767
|
-
for(c in a) {
|
768
|
-
a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c])
|
769
|
-
}
|
770
|
-
return b
|
771
|
-
};
|
772
|
-
axs.utils.namedValues = function(a) {
|
773
|
-
var b = {}, c;
|
774
|
-
for(c in a) {
|
775
|
-
a.hasOwnProperty(c) && "function" != typeof a[c] && (b[c] = a[c])
|
776
|
-
}
|
777
|
-
return b
|
778
|
-
};
|
779
|
-
axs.utils.getQuerySelectorText = function(a) {
|
780
|
-
if(null == a || "HTML" == a.tagName) {
|
781
|
-
return"html"
|
782
|
-
}
|
783
|
-
if("BODY" == a.tagName) {
|
784
|
-
return"body"
|
785
|
-
}
|
786
|
-
if(a.hasAttribute) {
|
787
|
-
if(a.id) {
|
788
|
-
return"#" + a.id
|
789
|
-
}
|
790
|
-
if(a.className) {
|
791
|
-
for(var b = "", c = 0;c < a.classList.length;c++) {
|
792
|
-
b += "." + a.classList[c]
|
793
|
-
}
|
794
|
-
var d = 0;
|
795
|
-
if(a.parentNode) {
|
796
|
-
for(c = 0;c < a.parentNode.children.length;c++) {
|
797
|
-
var e = a.parentNode.children[c];
|
798
|
-
axs.browserUtils.matchSelector(e, b) && d++;
|
799
|
-
if(e === a) {
|
800
|
-
break
|
801
|
-
}
|
802
|
-
}
|
803
|
-
}else {
|
804
|
-
d = 1
|
805
|
-
}
|
806
|
-
return 1 == d ? axs.utils.getQuerySelectorText(a.parentNode) + " > " + b : axs.utils.getQuerySelectorText(a.parentNode) + " > " + b + ":nth-of-type(" + d + ")"
|
807
|
-
}
|
808
|
-
if(a.parentNode) {
|
809
|
-
b = a.parentNode.children;
|
810
|
-
d = 1;
|
811
|
-
for(c = 0;b[c] !== a;) {
|
812
|
-
b[c].tagName == a.tagName && d++, c++
|
813
|
-
}
|
814
|
-
c = "";
|
815
|
-
"BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.parentNode) + " > ");
|
816
|
-
return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"
|
817
|
-
}
|
818
|
-
}else {
|
819
|
-
if(a.selectorText) {
|
820
|
-
return a.selectorText
|
821
|
-
}
|
822
|
-
}
|
823
|
-
return""
|
824
|
-
};
|
825
|
-
axs.AuditRule = function(a) {
|
826
|
-
for(var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) {
|
827
|
-
var e = axs.AuditRule.requiredFields[d];
|
828
|
-
e in a || (b = !1, c.push(e))
|
829
|
-
}
|
830
|
-
if(!b) {
|
831
|
-
throw"Invalid spec; the following fields were not specified: " + c.join(", ") + "\n" + JSON.stringify(a);
|
832
|
-
}
|
833
|
-
this.name = a.name;
|
834
|
-
this.severity = a.severity;
|
835
|
-
this.relevantNodesSelector_ = a.relevantNodesSelector;
|
836
|
-
this.test_ = a.test;
|
837
|
-
this.code = a.code;
|
838
|
-
this.heading = a.heading || "";
|
839
|
-
this.url = a.url || "";
|
840
|
-
this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI
|
841
|
-
};
|
842
|
-
axs.AuditRule.requiredFields = ["name", "severity", "relevantNodesSelector", "test", "code"];
|
843
|
-
axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA};
|
844
|
-
axs.AuditRule.prototype.addNode = function(a, b) {
|
845
|
-
a.push(b)
|
846
|
-
};
|
847
|
-
axs.AuditRule.prototype.run = function(a, b) {
|
848
|
-
function c(a) {
|
849
|
-
for(var b = 0;b < d.length;b++) {
|
850
|
-
if(axs.browserUtils.matchSelector(a, d[b])) {
|
851
|
-
return!0
|
852
|
-
}
|
853
|
-
}
|
854
|
-
return!1
|
855
|
-
}
|
856
|
-
var d = a || [], e = this.relevantNodesSelector_(b || document), f = [];
|
857
|
-
if(e instanceof XPathResult) {
|
858
|
-
if(e.resultType == XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) {
|
859
|
-
if(!e.snapshotLength) {
|
860
|
-
return axs.AuditRule.NOT_APPLICABLE
|
861
|
-
}
|
862
|
-
for(var g = 0;g < e.snapshotLength;g++) {
|
863
|
-
var h = e.snapshotItem(g);
|
864
|
-
this.test_(h) && !c(h) && this.addNode(f, h)
|
865
|
-
}
|
866
|
-
}else {
|
867
|
-
return console.warn("Unknown XPath result type", e), null
|
868
|
-
}
|
869
|
-
}else {
|
870
|
-
if(!e.length) {
|
871
|
-
return{result:axs.constants.AuditResult.NA}
|
872
|
-
}
|
873
|
-
for(g = 0;g < e.length;g++) {
|
874
|
-
h = e[g], this.test_(h) && !c(h) && this.addNode(f, h)
|
875
|
-
}
|
876
|
-
}
|
877
|
-
return{result:f.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditResult.PASS, elements:f}
|
878
|
-
};
|
879
|
-
axs.AuditRule.specs = {};
|
880
|
-
axs.AuditRules = {};
|
881
|
-
axs.AuditRules.getRule = function(a) {
|
882
|
-
if(!axs.AuditRules.rules) {
|
883
|
-
axs.AuditRules.rules = {};
|
884
|
-
for(var b in axs.AuditRule.specs) {
|
885
|
-
var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c);
|
886
|
-
axs.AuditRules.rules[c.name] = d
|
887
|
-
}
|
888
|
-
}
|
889
|
-
return axs.AuditRules.rules[a]
|
890
|
-
};
|
891
|
-
axs.AuditResults = function() {
|
892
|
-
this.errors_ = [];
|
893
|
-
this.warnings_ = []
|
894
|
-
};
|
895
|
-
goog.exportSymbol("axs.AuditResults", axs.AuditResults);
|
896
|
-
axs.AuditResults.prototype.addError = function(a) {
|
897
|
-
"" != a && this.errors_.push(a)
|
898
|
-
};
|
899
|
-
goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.prototype.addError);
|
900
|
-
axs.AuditResults.prototype.addWarning = function(a) {
|
901
|
-
"" != a && this.warnings_.push(a)
|
902
|
-
};
|
903
|
-
goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.prototype.addWarning);
|
904
|
-
axs.AuditResults.prototype.numErrors = function() {
|
905
|
-
return this.errors_.length
|
906
|
-
};
|
907
|
-
goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.prototype.numErrors);
|
908
|
-
axs.AuditResults.prototype.numWarnings = function() {
|
909
|
-
return this.warnings_.length
|
910
|
-
};
|
911
|
-
goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.prototype.numWarnings);
|
912
|
-
axs.AuditResults.prototype.getErrors = function() {
|
913
|
-
return this.errors_
|
914
|
-
};
|
915
|
-
goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.prototype.getErrors);
|
916
|
-
axs.AuditResults.prototype.getWarnings = function() {
|
917
|
-
return this.warnings_
|
918
|
-
};
|
919
|
-
goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.prototype.getWarnings);
|
920
|
-
axs.AuditResults.prototype.toString = function() {
|
921
|
-
for(var a = "", b = 0;b < this.errors_.length;b++) {
|
922
|
-
0 == b && (a += "\nErrors:\n");
|
923
|
-
var c = this.errors_[b], a = a + (c + "\n\n")
|
924
|
-
}
|
925
|
-
for(b = 0;b < this.warnings_.length;b++) {
|
926
|
-
0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"
|
927
|
-
}
|
928
|
-
return a
|
929
|
-
};
|
930
|
-
goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.prototype.toString);
|
931
|
-
axs.Audit = {};
|
932
|
-
axs.AuditConfiguration = function() {
|
933
|
-
this.rules_ = {};
|
934
|
-
this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null;
|
935
|
-
this.withConsoleApi = !1;
|
936
|
-
goog.exportProperty(this, "scope", this.scope);
|
937
|
-
goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun);
|
938
|
-
goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore);
|
939
|
-
goog.exportProperty(this, "withConsoleApi", this.withConsoleApi)
|
940
|
-
};
|
941
|
-
goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration);
|
942
|
-
axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) {
|
943
|
-
a in this.rules_ || (this.rules_[a] = {});
|
944
|
-
"ignore" in this.rules_[a] || (this.rules_[a].ignore = []);
|
945
|
-
Array.prototype.push.call(this.rules_[a].ignore, b)
|
946
|
-
}, getIgnoreSelectors:function(a) {
|
947
|
-
return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : []
|
948
|
-
}};
|
949
|
-
goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.AuditConfiguration.prototype.ignoreSelectors);
|
950
|
-
goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.AuditConfiguration.prototype.getIgnoreSelectors);
|
951
|
-
axs.Audit.run = function(a) {
|
952
|
-
a = a || new axs.AuditConfiguration;
|
953
|
-
var b = a.withConsoleApi, c = [], d;
|
954
|
-
d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Object.keys(axs.AuditRule.specs);
|
955
|
-
if(a.auditRulesToIgnore) {
|
956
|
-
for(var e = 0;e < a.auditRulesToIgnore.length;e++) {
|
957
|
-
var f = a.auditRulesToIgnore[e];
|
958
|
-
0 > d.indexOf(f) || d.splice(d.indexOf(f), 1)
|
959
|
-
}
|
960
|
-
}
|
961
|
-
for(e = 0;e < d.length;e++) {
|
962
|
-
if((f = axs.AuditRules.getRule(d[e])) && !f.disabled && (b || !f.requiresConsoleAPI)) {
|
963
|
-
var g = [], h = a.getIgnoreSelectors(f.name);
|
964
|
-
(0 < h.length || a.scope) && g.push(h);
|
965
|
-
a.scope && g.push(a.scope);
|
966
|
-
g = f.run.apply(f, g);
|
967
|
-
g.rule = axs.utils.namedValues(f);
|
968
|
-
c.push(g)
|
969
|
-
}
|
970
|
-
}
|
971
|
-
return c
|
972
|
-
};
|
973
|
-
goog.exportSymbol("axs.Audit.run", axs.Audit.run);
|
974
|
-
axs.Audit.auditResults = function(a) {
|
975
|
-
for(var b = new axs.AuditResults, c = 0;c < a.length;c++) {
|
976
|
-
var d = a[c];
|
977
|
-
d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.constants.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.addWarning(axs.Audit.accessibilityErrorMessage(d)))
|
978
|
-
}
|
979
|
-
return b
|
980
|
-
};
|
981
|
-
goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults);
|
982
|
-
axs.Audit.createReport = function(a, b) {
|
983
|
-
var c;
|
984
|
-
c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString();
|
985
|
-
b && (c += "\nFor more information, please see ", c += b);
|
986
|
-
return c += "\n*** End accessibility audit results ***"
|
987
|
-
};
|
988
|
-
goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport);
|
989
|
-
axs.Audit.accessibilityErrorMessage = function(a) {
|
990
|
-
for(var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "Warning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the following " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements.length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.elements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) {
|
991
|
-
var e = a.elements[d], b = b + "\n";
|
992
|
-
try {
|
993
|
-
b += axs.utils.getQuerySelectorText(e)
|
994
|
-
}catch(f) {
|
995
|
-
b += " tagName:" + e.tagName, b += " id:" + e.id
|
996
|
-
}
|
997
|
-
}
|
998
|
-
"" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information.");
|
999
|
-
return b
|
1000
|
-
};
|
1001
|
-
goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibilityErrorMessage);
|
1002
|
-
axs.browserUtils = {};
|
1003
|
-
axs.browserUtils.matchSelector = function(a, b) {
|
1004
|
-
return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector(b)
|
1005
|
-
};
|
1006
|
-
axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading:"Audio elements should have controls", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1007
|
-
return a.querySelectorAll("audio[autoplay]")
|
1008
|
-
}, test:function(a) {
|
1009
|
-
return!a.querySelectorAll("[controls]").length && 3 < a.duration
|
1010
|
-
}, code:"AX_AUDIO_01"};
|
1011
|
-
axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", heading:"ARIA state and property values must be valid", url:"", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
|
1012
|
-
var b = "", c;
|
1013
|
-
for(c in axs.constants.ARIA_PROPERTIES) {
|
1014
|
-
b += "[aria-" + c + "],"
|
1015
|
-
}
|
1016
|
-
b = b.substring(0, b.length - 1);
|
1017
|
-
return a.querySelectorAll(b)
|
1018
|
-
}, test:function(a) {
|
1019
|
-
for(var b in axs.constants.ARIA_PROPERTIES) {
|
1020
|
-
var c = "aria-" + b;
|
1021
|
-
if(a.hasAttribute(c)) {
|
1022
|
-
var d = a.getAttribute(c);
|
1023
|
-
if(!axs.utils.getAriaPropertyValue(c, d, a).valid) {
|
1024
|
-
return!0
|
1025
|
-
}
|
1026
|
-
}
|
1027
|
-
}
|
1028
|
-
return!1
|
1029
|
-
}, code:"AX_ARIA_04"};
|
1030
|
-
axs.AuditRule.specs.badAriaRole = {name:"badAriaRole", heading:"Elements with ARIA roles must use a valid, non-abstract ARIA role", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_ARIA_01:_Elements_with_ARIA_roles_must_use_a_valid,_non-abstr", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
|
1031
|
-
return a.querySelectorAll("[role]")
|
1032
|
-
}, test:function(a) {
|
1033
|
-
return!axs.utils.getRole(a).valid
|
1034
|
-
}, code:"AX_ARIA_01"};
|
1035
|
-
axs.AuditRule.specs.controlsWithoutLabel = {name:"controlsWithoutLabel", heading:"Controls and media elements should have labels", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_TEXT_01:_Controls_and_media_elements_should_have_labels", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
|
1036
|
-
return a.querySelectorAll('input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])')
|
1037
|
-
}, test:function(a) {
|
1038
|
-
return axs.utils.isElementOrAncestorHidden(a) || "button" == a.tagName.toLowerCase() && a.textContent.replace(/^\s+|\s+$/g, "").length ? !1 : axs.utils.hasLabel(a) ? !1 : !0
|
1039
|
-
}, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"};
|
1040
|
-
axs.AuditRule.specs.focusableElementNotVisibleAndNotAriaHidden = {name:"focusableElementNotVisibleAndNotAriaHidden", heading:"These elements are focusable but either invisible or obscured by another element", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_FOCUS_01:_These_elements_are_focusable_but_either_invisible_o", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1041
|
-
return a.querySelectorAll(axs.utils.FOCUSABLE_ELEMENTS_SELECTOR)
|
1042
|
-
}, test:function(a) {
|
1043
|
-
return axs.utils.isElementOrAncestorHidden(a) ? !1 : !axs.utils.elementIsVisible(a)
|
1044
|
-
}, code:"AX_FOCUS_01"};
|
1045
|
-
axs.AuditRule.specs.imagesWithoutAltText = {name:"imagesWithoutAltText", heading:"Images should have an alt attribute", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_TEXT_02:_Images_should_have_an_alt_attribute,_unless_they_hav", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1046
|
-
a = a.querySelectorAll("img");
|
1047
|
-
for(var b = [], c = 0;c < a.length;c++) {
|
1048
|
-
var d = a[c];
|
1049
|
-
axs.utils.isElementOrAncestorHidden(d) || b.push(d)
|
1050
|
-
}
|
1051
|
-
return b
|
1052
|
-
}, test:function(a) {
|
1053
|
-
return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role")
|
1054
|
-
}, code:"AX_TEXT_02"};
|
1055
|
-
axs.AuditRule.specs.linkWithUnclearPurpose = {name:"linkWithUnclearPurpose", heading:"The purpose of each link should be clear from the link text", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1056
|
-
return a.querySelectorAll("a")
|
1057
|
-
}, test:function(a) {
|
1058
|
-
return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent)
|
1059
|
-
}, code:"AX_TITLE_01"};
|
1060
|
-
axs.AuditRule.specs.lowContrastElements = {name:"lowContrastElements", heading:"Text elements should have a reasonable contrast ratio", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_COLOR_01:_Text_elements_should_have_a_reasonable_contrast_rat", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1061
|
-
return document.evaluate('/html/body//text()[normalize-space(.)!=""]/parent::*[name()!="script"]', a, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
|
1062
|
-
}, test:function(a) {
|
1063
|
-
var b = window.getComputedStyle(a, null);
|
1064
|
-
return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs.utils.isLowContrast(a, b)
|
1065
|
-
}, code:"AX_COLOR_01"};
|
1066
|
-
axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithMeaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1067
|
-
a = a.querySelectorAll("*");
|
1068
|
-
for(var b = [], c = 0;c < a.length;c++) {
|
1069
|
-
var d = a[c];
|
1070
|
-
axs.utils.isElementOrAncestorHidden(d) || b.push(d)
|
1071
|
-
}
|
1072
|
-
return b
|
1073
|
-
}, heading:"Meaningful images should not be used in element backgrounds", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules?ts=1368336558&updated=AuditRules#AX_IMAGE_01:_Meaningful_images_should_not_be_used_in_element_bac", test:function(a) {
|
1074
|
-
if(a.textContent && 0 < a.textContent.length) {
|
1075
|
-
return!1
|
1076
|
-
}
|
1077
|
-
a = window.getComputedStyle(a, null);
|
1078
|
-
var b = a.backgroundImage;
|
1079
|
-
if(!b || "undefined" === b || "none" === b) {
|
1080
|
-
return!1
|
1081
|
-
}
|
1082
|
-
b = parseInt(a.width, 10);
|
1083
|
-
a = parseInt(a.height, 10);
|
1084
|
-
return 150 > b && 150 > a
|
1085
|
-
}, code:"AX_IMAGE_01"};
|
1086
|
-
axs.AuditRule.specs.nonExistentAriaLabelledbyElement = {name:"nonExistentAriaLabelledbyElement", heading:"aria-labelledby attributes should refer to an element which exists in the DOM", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_ARIA_02:__aria-labelledby_attributes_should_refer_to_an_eleme", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1087
|
-
return a.querySelectorAll("[aria-labelledby]")
|
1088
|
-
}, test:function(a) {
|
1089
|
-
a = a.getAttribute("aria-labelledby").split(/\s+/);
|
1090
|
-
for(var b = 0;b < a.length;b++) {
|
1091
|
-
if(!document.getElementById(a[b])) {
|
1092
|
-
return!0
|
1093
|
-
}
|
1094
|
-
}
|
1095
|
-
return!1
|
1096
|
-
}, code:"AX_ARIA_02"};
|
1097
|
-
axs.AuditRule.specs.pageWithoutTitle = {name:"pageWithoutTitle", heading:"The web page should have a title that describes topic or purpose", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1098
|
-
return a
|
1099
|
-
}, test:function(a) {
|
1100
|
-
a = a.querySelector("head");
|
1101
|
-
if(!a) {
|
1102
|
-
return!0
|
1103
|
-
}
|
1104
|
-
a = a.querySelector("title");
|
1105
|
-
return!a.length || !a[0].textContent
|
1106
|
-
}, code:"AX_TITLE_01"};
|
1107
|
-
axs.AuditRule.specs.requiredAriaAttributeMissing = {name:"requiredAriaAttributeMissing", heading:"Elements with ARIA roles must have all required attributes for that role", url:"", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
|
1108
|
-
return a.querySelectorAll("[role]")
|
1109
|
-
}, test:function(a) {
|
1110
|
-
var b = axs.utils.getRole(a);
|
1111
|
-
if(!b.valid) {
|
1112
|
-
return!1
|
1113
|
-
}
|
1114
|
-
var b = b.details.requiredPropertiesSet, c;
|
1115
|
-
for(c in b) {
|
1116
|
-
b = c.replace(/^aria-/, "");
|
1117
|
-
if("defaultValue" in axs.constants.ARIA_PROPERTIES[b]) {
|
1118
|
-
return!1
|
1119
|
-
}
|
1120
|
-
if(!a.hasAttribute(c)) {
|
1121
|
-
return!0
|
1122
|
-
}
|
1123
|
-
}
|
1124
|
-
}, code:"AX_ARIA_03"};
|
1125
|
-
axs.AuditRule.specs.unfocusableElementsWithOnClick = {name:"unfocusableElementsWithOnClick", heading:"Elements with onclick handlers must be focusable", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_FOCUS_02:_Elements_with_onclick_handlers_must_be_focusable", severity:axs.constants.Severity.WARNING, opt_requiresConsoleAPI:!0, relevantNodesSelector:function(a) {
|
1126
|
-
a = a.querySelectorAll("*");
|
1127
|
-
for(var b = [], c = 0;c < a.length;c++) {
|
1128
|
-
var d = a[c];
|
1129
|
-
d instanceof d.ownerDocument.defaultView.HTMLBodyElement || axs.utils.isElementOrAncestorHidden(d) || "click" in getEventListeners(d) && b.push(d)
|
1130
|
-
}
|
1131
|
-
return b
|
1132
|
-
}, test:function(a) {
|
1133
|
-
return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a)
|
1134
|
-
}, code:"AX_FOCUS_02"};
|
1135
|
-
axs.AuditRule.specs.videoWithoutCaptions = {name:"videoWithoutCaptions", heading:"Video elements should use <track> elements to provide captions", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_VIDEO_01:_Video_elements_should_use_<track>_elements_to", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
|
1136
|
-
return a.querySelectorAll("video")
|
1137
|
-
}, test:function(a) {
|
1138
|
-
return!a.querySelectorAll("track[kind=captions]").length
|
1139
|
-
}, code:"AX_VIDEO_01"};
|
1140
|
-
|