Commit 0466829
committed
Align relaxed-<select> implementation with spec, in line with review comments
Move selectedcontent cloning from TreeBuilder to DOM-side subclasses:
the optionElementPopped() hook now walks the live DOM to find the
ancestor <select> and its <selectedcontent>, check selectedness, and
clone option children — rather than relying on parser-tracked state.
Implemented in all four subclasses (DOMTreeBuilder, SAXTreeBuilder,
XOMTreeBuilder, BrowserTreeBuilder).
Remove all dead IN_SELECT / IN_SELECT_IN_TABLE mode code (handlers,
constants, end-tag special cases) — with <select> “relaxation”, those
modes are never entered.
Fix resetTheInsertionMode to skip past <select> elements on the stack
instead of incorrectly returning IN_BODY — an enclosing td/th now
correctly yields IN_CELL, an enclosing table yields IN_TABLE, etc.
Align start-tag handling with the spec:
- HR: use generateImpliedEndTags() instead of manual isCurrent/pop
- OPTION/OPTGROUP: remove redundant pop loops (spec says parse error
only), add missing reconstructTheActiveFormattingElements for
optgroup, fix optgroup to check both option and optgroup in scope
- SELECT: check fragment case first, remove generateImpliedEndTags
from nested case, add framesetOk = false
- INPUT: add explicit fragment-case guard
- Table elements (caption, tbody, tr, td, th): treat as stray start
tags, removing the old IN_SELECT_IN_TABLE dual-scope check
Fold </select> end tag into the standard block-element group (with
div, fieldset, button, etc.) — the dedicated resetTheInsertionMode
call is no longer needed.
Add spec URLs and verbatim spec-text comments throughout all
<select>-related code sections — for traceability and review-ability.1 parent 87fe37a commit 0466829
File tree
7 files changed
+364
-499
lines changed- gwt-src/nu/validator/htmlparser/gwt
- src/nu/validator/htmlparser
- dom
- impl
- sax
- xom
- test-src/test/resources
7 files changed
+364
-499
lines changedLines changed: 68 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
478 | 493 | | |
479 | | - | |
480 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
481 | 497 | | |
482 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
483 | 528 | | |
484 | 529 | | |
485 | 530 | | |
486 | | - | |
487 | | - | |
488 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
489 | 534 | | |
490 | 535 | | |
491 | 536 | | |
492 | 537 | | |
493 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
494 | 557 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
360 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
361 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
362 | 396 | | |
363 | 397 | | |
364 | 398 | | |
365 | | - | |
366 | | - | |
| 399 | + | |
| 400 | + | |
367 | 401 | | |
368 | | - | |
369 | 402 | | |
370 | 403 | | |
371 | 404 | | |
372 | 405 | | |
373 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
374 | 426 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1428 | 1428 | | |
1429 | 1429 | | |
1430 | 1430 | | |
1431 | | - | |
| 1431 | + | |
1432 | 1432 | | |
1433 | 1433 | | |
1434 | 1434 | | |
| |||
0 commit comments