Repository navigation
Conversation
…and the page noticed, not the audit failed #1557 Signed-off-by: Nik Cubrilovic <[email protected]> (cherry picked from commit 911dcc0)
…ing, notice it on every path, split class on HTML whitespace #1557 #1569 #1570 #1571 #1567 Cut offsets come from htmlparser2's Parser (linkedom's own tokenizer and options), not a hand-written scanner: comments, bogus comments, CDATA, raw-text elements, entity whitespace, duplicate and upper-case class no longer steer the cut. The CLI's parsePageRecord carries the notice, html-parse has its own solution text, retry is RangeError-only and any throw ends in an empty document. className splits on ASCII whitespace. Signed-off-by: Nik Cubrilovic <[email protected]>
…okenizer's entity start; state the #1567 residual #1557 #1567 Signed-off-by: Nik Cubrilovic <[email protected]>
…n, not mock.module (it leaked into later test files) #1557 #1571 Signed-off-by: Nik Cubrilovic <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
packages/parser/src/dom.ts: where to cut an overflowingclassnow comes from htmlparser2'sParser(the tokenizer linkedom parses with), run with linkedom's own options and attribute events overridden to report offsets. The hand-written scanner of fix(parser,rules): a class attribute that overflows the parse is cut and the page noticed, not the audit failed #1557 #1558 is gone, so there is no second reading of the markup to disagree with the parse. Only the firstclassof a real tag, spelt exactlyclass, is read (as linkedom reads it); a tag cut off by the end of the page is not cut.classNamesplits on the five ASCII whitespace characters (parser: linkedom folds NBSP, U+2003, U+FEFF and VT in a class value to a space #1567); NBSP, U+2003, U+FEFF and VT stay inside a token.parsePageRecordcarriesparseNotices(parity test across all three producers);html-parsehas its own solution text; docs list both checks.entityStart, so a class made only of entities is cut at the right place (4 new differential cases, failing before); a test pins that this package and linkedom resolve the same htmlparser2 copy.htmlparser2 ^10.1.0inpackages/parser(the version linkedom already resolves; lockfile gains one line).Acceptance criteria
huge-class-1557.test.ts,audit-engine/tests/huge-class-parse-1557.test.ts).class-cut-differential.test.ts): 57 pass here, 21 fail on fix(parser,rules): a class attribute that overflows the parse is cut and the page noticed, not the audit failed #1557 #1558's cut. Not done: the 100,000-document generated differential.parsePageRecordsets the notice (parity test), own solution text, docs list both checks and the cost of a cut.parse-contained-1557.test.ts), the dead loop now asserts, unterminated quote and cut-off tag.class-split-1567.test.ts). Residual, stated in CHANGELOG and docs: only HTML elements' class lists are covered;<svg>class, css-select.a/[class~=a]and rules that split class on\s+still fold.Skills: no agent skill change needed.