diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ad47c23..031c8c56 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
## [Unreleased]
+### Changed
+
+- Fix `iframe-has-title` such that if the attribute is ommitted completely that it fires correctly.
+
## [0.6.1] - 2021-01-21
### Changed
diff --git a/src/rules/__tests__/iframe-has-title.test.js b/src/rules/__tests__/iframe-has-title.test.js
index 716c3d6c..9c9a3052 100644
--- a/src/rules/__tests__/iframe-has-title.test.js
+++ b/src/rules/__tests__/iframe-has-title.test.js
@@ -3,5 +3,5 @@ const makeRuleTester = require("./makeRuleTester");
makeRuleTester("iframe-has-title", rule, {
valid: ["", ""],
- invalid: ["", ""]
+ invalid: ["", "", ""]
});
diff --git a/src/rules/iframe-has-title.js b/src/rules/iframe-has-title.js
index 8983b3c0..9a865365 100644
--- a/src/rules/iframe-has-title.js
+++ b/src/rules/iframe-has-title.js
@@ -1,6 +1,6 @@
const {
defineTemplateBodyVisitor,
- getLiteralAttributeValue,
+ getElementAttributeValue,
makeDocsURL
} = require("../utils");
@@ -16,9 +16,9 @@ module.exports = {
create(context) {
return defineTemplateBodyVisitor(context, {
"VElement[name='iframe']"(node) {
- const title = getLiteralAttributeValue(node, "title");
+ const title = getElementAttributeValue(node, "title");
- if (!["string", "object"].includes(typeof title)) {
+ if (title === null || !["string", "object"].includes(typeof title)) {
context.report({ node, messageId: "default" });
}
}