html-validate 10.11.1 → 10.11.3

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/cjs/core.js CHANGED
@@ -6832,14 +6832,14 @@ class EmptyTitle extends Rule {
6832
6832
  }
6833
6833
  switch (classifyNodeText(node)) {
6834
6834
  case TextClassification.DYNAMIC_TEXT:
6835
- case TextClassification.STATIC_TEXT:
6835
+ case TextClassification.STATIC_TEXT: {
6836
6836
  break;
6837
- case TextClassification.EMPTY_TEXT:
6838
- {
6839
- const message = `<${node.tagName}> cannot be empty, must have text content`;
6840
- this.report(node, message, node.location);
6841
- }
6837
+ }
6838
+ case TextClassification.EMPTY_TEXT: {
6839
+ const message = `<${node.tagName}> cannot be empty, must have text content`;
6840
+ this.report(node, message, node.location);
6842
6841
  break;
6842
+ }
6843
6843
  }
6844
6844
  });
6845
6845
  }
@@ -9878,6 +9878,10 @@ const lowercaseEntities = elements.entities.map((it) => it.toLowerCase());
9878
9878
  function isNumerical(entity) {
9879
9879
  return entity.startsWith("&#");
9880
9880
  }
9881
+ function isAfterQueryOrFragment(delimiterIndex, match) {
9882
+ const matchIndex = match.match.index ?? 0;
9883
+ return delimiterIndex !== -1 && matchIndex > delimiterIndex;
9884
+ }
9881
9885
  function getLocation(location, entity, match) {
9882
9886
  const index = match.index ?? 0;
9883
9887
  return sliceLocation(location, index, index + entity.length);
@@ -9953,18 +9957,21 @@ class UnknownCharReference extends Rule {
9953
9957
  }
9954
9958
  }
9955
9959
  findCharacterReferences(node, text, location, { isAttribute }) {
9956
- const isQuerystring = isAttribute && text.includes("?");
9960
+ const delimiter = text.search(/[?#]/);
9957
9961
  for (const match of this.getMatches(text)) {
9958
- this.validateCharacterReference(node, location, match, { isQuerystring });
9962
+ const allowUnterminated = isAttribute && isAfterQueryOrFragment(delimiter, match);
9963
+ this.validateCharacterReference(node, location, match, {
9964
+ allowUnterminated
9965
+ });
9959
9966
  }
9960
9967
  }
9961
- validateCharacterReference(node, location, foobar, { isQuerystring }) {
9968
+ validateCharacterReference(node, location, entityMatch, { allowUnterminated }) {
9962
9969
  const { requireSemicolon } = this.options;
9963
- const { match, entity, raw, terminated } = foobar;
9970
+ const { match, entity, raw, terminated } = entityMatch;
9964
9971
  if (isNumerical(entity)) {
9965
9972
  return;
9966
9973
  }
9967
- if (isQuerystring && !terminated) {
9974
+ if (!terminated && allowUnterminated) {
9968
9975
  return;
9969
9976
  }
9970
9977
  const found = this.entities.includes(entity);
@@ -12503,7 +12510,7 @@ class EventHandler {
12503
12510
  }
12504
12511
 
12505
12512
  const name = "html-validate";
12506
- const version = "10.11.1";
12513
+ const version = "10.11.3";
12507
12514
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
12508
12515
 
12509
12516
  function freeze(src) {