Skip to content

Commit b66749e

Browse files
authored
Merge pull request #143 from vue-a11y/fix-130
Fix for #130
2 parents 11c2680 + afea04a commit b66749e

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Fix `iframe-has-title` such that if the attribute is ommitted completely that it fires correctly.
12+
913
## [0.6.1] - 2021-01-21
1014

1115
### Changed

src/rules/__tests__/iframe-has-title.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const makeRuleTester = require("./makeRuleTester");
33

44
makeRuleTester("iframe-has-title", rule, {
55
valid: ["<iframe title='test' />", "<iframe :title='test' />"],
6-
invalid: ["<iframe :title='true' />", "<iframe :title='2' />"]
6+
invalid: ["<iframe />", "<iframe :title='true' />", "<iframe :title='2' />"]
77
});

src/rules/iframe-has-title.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const {
22
defineTemplateBodyVisitor,
3-
getLiteralAttributeValue,
3+
getElementAttributeValue,
44
makeDocsURL
55
} = require("../utils");
66

@@ -16,9 +16,9 @@ module.exports = {
1616
create(context) {
1717
return defineTemplateBodyVisitor(context, {
1818
"VElement[name='iframe']"(node) {
19-
const title = getLiteralAttributeValue(node, "title");
19+
const title = getElementAttributeValue(node, "title");
2020

21-
if (!["string", "object"].includes(typeof title)) {
21+
if (title === null || !["string", "object"].includes(typeof title)) {
2222
context.report({ node, messageId: "default" });
2323
}
2424
}

0 commit comments

Comments
 (0)