aria-api 0.4.5 → 0.4.6

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.
package/dist/aria.js CHANGED
@@ -163,7 +163,7 @@ var getAttribute = function(el, key) {
163
163
  if (el.matches('noscript')) {
164
164
  return true;
165
165
  }
166
- if (el.matches('details:not([open]) :not(summary)')) {
166
+ if (el.matches('details:not([open]) > :not(summary)')) {
167
167
  return true;
168
168
  }
169
169
  var style = window.getComputedStyle(el);
@@ -528,6 +528,9 @@ exports.roles = {
528
528
  'selected': 'false',
529
529
  },
530
530
  },
531
+ presentation: {
532
+ selectors: ['img[alt=""]'],
533
+ },
531
534
  progressbar: {
532
535
  selectors: ['progress'],
533
536
  },
@@ -932,10 +935,16 @@ var getName = function(el, recursive, visited, directReference) {
932
935
 
933
936
  // I
934
937
  // FIXME: presentation not mentioned in the spec
935
- if (!ret.trim() && !query.matches(el, 'presentation')) {
938
+ if (!ret.trim() && (directReference || !query.matches(el, 'presentation'))) {
936
939
  ret = el.title || '';
937
940
  }
938
941
 
942
+ // FIXME: not exactly sure about this, but it reduces the number of failing
943
+ // WPT tests. Whitespace is hard.
944
+ if (!ret.trim()) {
945
+ ret = ' ';
946
+ }
947
+
939
948
  var before = getPseudoContent(el, ':before');
940
949
  var after = getPseudoContent(el, ':after');
941
950
  return before + ret + after;
package/lib/attrs.js CHANGED
@@ -50,7 +50,7 @@ var getAttribute = function(el, key) {
50
50
  if (el.matches('noscript')) {
51
51
  return true;
52
52
  }
53
- if (el.matches('details:not([open]) :not(summary)')) {
53
+ if (el.matches('details:not([open]) > :not(summary)')) {
54
54
  return true;
55
55
  }
56
56
  var style = window.getComputedStyle(el);
package/lib/constants.js CHANGED
@@ -295,6 +295,9 @@ exports.roles = {
295
295
  'selected': 'false',
296
296
  },
297
297
  },
298
+ presentation: {
299
+ selectors: ['img[alt=""]'],
300
+ },
298
301
  progressbar: {
299
302
  selectors: ['progress'],
300
303
  },
package/lib/name.js CHANGED
@@ -149,10 +149,16 @@ var getName = function(el, recursive, visited, directReference) {
149
149
 
150
150
  // I
151
151
  // FIXME: presentation not mentioned in the spec
152
- if (!ret.trim() && !query.matches(el, 'presentation')) {
152
+ if (!ret.trim() && (directReference || !query.matches(el, 'presentation'))) {
153
153
  ret = el.title || '';
154
154
  }
155
155
 
156
+ // FIXME: not exactly sure about this, but it reduces the number of failing
157
+ // WPT tests. Whitespace is hard.
158
+ if (!ret.trim()) {
159
+ ret = ' ';
160
+ }
161
+
156
162
  var before = getPseudoContent(el, ':before');
157
163
  var after = getPseudoContent(el, ':after');
158
164
  return before + ret + after;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-api",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Access ARIA information from JavaScript",
5
5
  "main": "index.js",
6
6
  "keywords": [