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