@herb-tools/linter 0.8.0 → 0.8.1

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/index.js CHANGED
@@ -3053,6 +3053,8 @@ function findAttributeByName(attributes, attributeName) {
3053
3053
  * Checks if a tag has a specific attribute
3054
3054
  */
3055
3055
  function hasAttribute(node, attributeName) {
3056
+ if (!node)
3057
+ return false;
3056
3058
  return getAttribute(node, attributeName) !== null;
3057
3059
  }
3058
3060
  /**
@@ -5152,8 +5154,13 @@ class HeadOnlyElementsVisitor extends BaseRuleVisitor {
5152
5154
  return;
5153
5155
  if (tagName === "title" && this.insideSVG)
5154
5156
  return;
5157
+ if (tagName === "meta" && this.hasItempropAttribute(node))
5158
+ return;
5155
5159
  this.addOffense(`Element \`<${tagName}>\` must be placed inside the \`<head>\` tag.`, node.location);
5156
5160
  }
5161
+ hasItempropAttribute(node) {
5162
+ return hasAttribute(node.open_tag, "itemprop");
5163
+ }
5157
5164
  get insideHead() {
5158
5165
  return this.elementStack.includes("head");
5159
5166
  }