Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Checking if contentDocument exists (I iframe can point to a 404 URL...)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhsv committed May 5, 2015
1 parent 08b3be1 commit dc66bb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions dist/js/axs_testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Generated from https://github.com/GoogleChrome/accessibility-developer-tools/tree/88731e16c8639738a1375f8c2de1ec2a23fcb631
* Generated from https://github.com/GoogleChrome/accessibility-developer-tools/tree/08b3be1e095d0203a094b370c27f77446a6c69e9
*
* See project README for build steps.
*/
Expand Down Expand Up @@ -1549,7 +1549,7 @@ axs.AuditRule.collectMatchingElements = function(a, b, c, d) {
console.warn("ShadowRoot not provided for", e);
}
}
e && "iframe" == e.localName && axs.AuditRule.collectMatchingElements(a.contentDocument, b, c, d);
e && "iframe" == e.localName && e.contentDocument && axs.AuditRule.collectMatchingElements(e.contentDocument, b, c, d);
for (a = a.firstChild;null != a;) {
axs.AuditRule.collectMatchingElements(a, b, c, d), a = a.nextSibling;
}
Expand Down Expand Up @@ -1866,7 +1866,8 @@ axs.AuditRules.addRule({name:"focusableElementNotVisibleAndNotAriaHidden", headi
return !1;
}
}
return "" === axs.properties.findTextAlternatives(a, {}).trim() ? !1 : !0;
a = axs.properties.findTextAlternatives(a, {});
return null == a || "" === a.trim() ? !1 : !0;
}, test:function(a) {
if (axs.utils.isElementOrAncestorHidden(a)) {
return !1;
Expand Down
3 changes: 2 additions & 1 deletion src/audits/FocusableElementNotVisibleAndNotAriaHidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ axs.AuditRules.addRule({
}
// Ignore elements which have a negative tabindex and no text content,
// as they will be skipped by assistive technology
if (axs.properties.findTextAlternatives(element, {}).trim() === '')
var alternative = axs.properties.findTextAlternatives(element, {});
if (alternative == null || alternative.trim() === '')
return false;

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/js/AuditRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ axs.AuditRule.collectMatchingElements = function(node, matcher, collection,
}

//If it is a iframe, get the contentDocument
if (element && element.localName == 'iframe') {
axs.AuditRule.collectMatchingElements(node.contentDocument,
if (element && element.localName == 'iframe' && element.contentDocument) {
axs.AuditRule.collectMatchingElements(element.contentDocument,
matcher,
collection,
opt_shadowRoot);
Expand Down

0 comments on commit dc66bb7

Please sign in to comment.