html-validate 6.1.6 → 6.2.0

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/es/core.js CHANGED
@@ -1772,6 +1772,14 @@ class Selector {
1772
1772
  }
1773
1773
 
1774
1774
  const TEXT_NODE_NAME = "#text";
1775
+ /**
1776
+ * Returns true if the node is a text node.
1777
+ *
1778
+ * @public
1779
+ */
1780
+ function isTextNode(node) {
1781
+ return Boolean(node && node.nodeType === NodeType.TEXT_NODE);
1782
+ }
1775
1783
  /**
1776
1784
  * Represents a text in the HTML document.
1777
1785
  *
@@ -2928,7 +2936,7 @@ var TRANSFORMER_API;
2928
2936
  /** @public */
2929
2937
  const name = "html-validate";
2930
2938
  /** @public */
2931
- const version = "6.1.6";
2939
+ const version = "6.2.0";
2932
2940
  /** @public */
2933
2941
  const homepage = "https://html-validate.org";
2934
2942
  /** @public */
@@ -4074,12 +4082,26 @@ class AttributeAllowedValues extends Rule {
4074
4082
  if (!context) {
4075
4083
  return docs;
4076
4084
  }
4077
- if (context.allowed.enum) {
4078
- const allowed = context.allowed.enum.map((val) => `- \`${val}\``);
4079
- docs.description = `Element <${context.element}> does not allow attribute \`${context.attribute}\` to have the value \`"${context.value}"\`, it must match one of the following:\n\n${allowed.join("\n")}`;
4085
+ const { allowed, attribute, element, value } = context;
4086
+ if (allowed.enum) {
4087
+ const allowedList = allowed.enum.map((value) => {
4088
+ if (typeof value === "string") {
4089
+ return `- \`"${value}"\``;
4090
+ }
4091
+ else {
4092
+ return `- \`${value.toString()}\``;
4093
+ }
4094
+ });
4095
+ docs.description = [
4096
+ `The \`<${element}>\` element does not allow the attribute \`${attribute}\` to have the value \`"${value}"\`.`,
4097
+ "",
4098
+ "It must match one of the following:",
4099
+ "",
4100
+ ...allowedList,
4101
+ ].join("\n");
4080
4102
  }
4081
- else if (context.allowed.boolean) {
4082
- docs.description = `Element <${context.element}> attribute \`${context.attribute}\` must be a boolean attribute, e.g. \`<${context.element} ${context.attribute}>\``;
4103
+ else if (allowed.boolean) {
4104
+ docs.description = `The \`<${context.element}>\` attribute \`${context.attribute}\` must be a boolean attribute, e.g. \`<${context.element} ${context.attribute}>\``;
4083
4105
  }
4084
4106
  return docs;
4085
4107
  }
@@ -7056,9 +7078,6 @@ function hasDefaultText(node) {
7056
7078
  const type = node.getAttribute("type");
7057
7079
  return Boolean(type && type.valueMatches(/submit|reset/, false));
7058
7080
  }
7059
- function isTextNode(node) {
7060
- return node.nodeType === NodeType.TEXT_NODE;
7061
- }
7062
7081
  function isNonEmptyText(node) {
7063
7082
  if (isTextNode(node)) {
7064
7083
  return node.isDynamic || node.textContent.trim() !== "";