html-minifier-next 6.1.4 → 6.1.5
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/htmlminifier.cjs +16 -3
- package/dist/types/htmlparser.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/htmlparser.js +16 -3
package/dist/htmlminifier.cjs
CHANGED
|
@@ -611,10 +611,23 @@ class HTMLParser {
|
|
|
611
611
|
continue;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
// Note: Unquoted attribute values are intentionally not handled here
|
|
614
|
+
// Note: Unquoted attribute values are intentionally not handled here
|
|
615
615
|
// Per HTML spec, unquoted values cannot contain spaces or special chars,
|
|
616
|
-
// making a 20 KB+ unquoted value practically impossible
|
|
617
|
-
// it’s malformed HTML and using the truncated regex match is acceptable
|
|
616
|
+
// making a 20 KB+ unquoted value practically impossible; if encountered,
|
|
617
|
+
// it’s malformed HTML and using the truncated regex match is acceptable
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
// If attr has no value assign but `=` follows in `fullHtml`,
|
|
621
|
+
// the value would be cut off—reset to trigger manual extraction below
|
|
622
|
+
const numCustomParts = handler.customAttrSurround
|
|
623
|
+
? handler.customAttrSurround.length * NCP
|
|
624
|
+
: 0;
|
|
625
|
+
const baseIndex = 1 + numCustomParts;
|
|
626
|
+
if (attr[baseIndex + 1] === undefined) {
|
|
627
|
+
const posAfterName = currentPos + attrEnd;
|
|
628
|
+
if (/^\s*=/.test(fullHtml.slice(posAfterName, posAfterName + 50))) {
|
|
629
|
+
attr = null;
|
|
630
|
+
}
|
|
618
631
|
}
|
|
619
632
|
}
|
|
620
633
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlparser.d.ts","sourceRoot":"","sources":["../../src/htmlparser.js"],"names":[],"mappings":"AAqDA,4BAAkE;AA0GlE;IACE,qCAGC;IAFC,UAAgB;IAChB,aAAsB;IAGxB,
|
|
1
|
+
{"version":3,"file":"htmlparser.d.ts","sourceRoot":"","sources":["../../src/htmlparser.js"],"names":[],"mappings":"AAqDA,4BAAkE;AA0GlE;IACE,qCAGC;IAFC,UAAgB;IAChB,aAAsB;IAGxB,uBAgnBC;CACF"}
|
package/package.json
CHANGED
package/src/htmlparser.js
CHANGED
|
@@ -510,10 +510,23 @@ export class HTMLParser {
|
|
|
510
510
|
continue;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
// Note: Unquoted attribute values are intentionally not handled here
|
|
513
|
+
// Note: Unquoted attribute values are intentionally not handled here
|
|
514
514
|
// Per HTML spec, unquoted values cannot contain spaces or special chars,
|
|
515
|
-
// making a 20 KB+ unquoted value practically impossible
|
|
516
|
-
// it’s malformed HTML and using the truncated regex match is acceptable
|
|
515
|
+
// making a 20 KB+ unquoted value practically impossible; if encountered,
|
|
516
|
+
// it’s malformed HTML and using the truncated regex match is acceptable
|
|
517
|
+
}
|
|
518
|
+
} else {
|
|
519
|
+
// If attr has no value assign but `=` follows in `fullHtml`,
|
|
520
|
+
// the value would be cut off—reset to trigger manual extraction below
|
|
521
|
+
const numCustomParts = handler.customAttrSurround
|
|
522
|
+
? handler.customAttrSurround.length * NCP
|
|
523
|
+
: 0;
|
|
524
|
+
const baseIndex = 1 + numCustomParts;
|
|
525
|
+
if (attr[baseIndex + 1] === undefined) {
|
|
526
|
+
const posAfterName = currentPos + attrEnd;
|
|
527
|
+
if (/^\s*=/.test(fullHtml.slice(posAfterName, posAfterName + 50))) {
|
|
528
|
+
attr = null;
|
|
529
|
+
}
|
|
517
530
|
}
|
|
518
531
|
}
|
|
519
532
|
}
|