Map the HTML presentational attributes per spec - #662
Open
latentharbor wants to merge 2 commits into
Open
Conversation
The parser was parse::<f32>() with any trailing unit peeled off, which rejected "200in" and "200 %", accepted "-200" and "+200", and read "20.25e2" as 2025px -- the rules for parsing dimension values have no exponent, so that is 20.25px followed by junk. Most of the element table was also missing. Follows 'rules for parsing dimension values' and the presentational hints each element actually maps. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
border on img/object/input[type=image] follows the rules for parsing non-negative integers and maps to the four border widths plus border-style: solid on all four sides -- width alone computes back to zero against the default border-style of none. marginwidth/marginheight/topmargin/leftmargin on body map to the margins the HTML standard lists for them. There is deliberately no rightmargin or bottommargin: the spec does not define them and WPT body-margin-3a/3b assert they are ignored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
latentharbor
force-pushed
the
map-html-presentational-attributes
branch
from
August 9, 2026 07:49
c80c5d0 to
b216d43
Compare
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.
Two commits reworking the legacy presentational-attribute mapping in
blitz-dom.Map the HTML dimension attributes per spec
The old parser was
parse::<f32>()with any trailing unit peeled off, which200inand200 %(trailing garbage is ignored per spec),-200and+200(dimension values have no sign),20.25e2as 2025px — the rules for parsing dimension values have no exponent, so that is 20.25px followed by junk.It also fills in the missing parts of the element table:
width/heighton the embedded elements (iframe,embed,video,object,img,marquee,input[type=image]) and the table elements (table,colgroup,col,tr,td,th, with the ignore-zero rules for cells and table width), andhspace/vspacemapping to the margin pairs.Map border and the body margin attributes
borderonimg/object/input[type=image]follows the rules for parsing non-negative integers and maps to the four border widths plusborder-style: solidon all four sides — width alone computes back to zero against the defaultborder-style: none.marginwidth/marginheight/topmargin/leftmarginonbodymap to the margins the HTML standard lists for them. Deliberately norightmargin/bottommargin: the spec does not define them, and WPTbody-margin-3a/3bassert they are ignored.Validation
WPT via the in-tree runner:
html/rendering: three tests go FAIL→PASS —non-replaced-elements/tables/table-row-height.html,non-replaced-elements/the-hr-element-0/width.html,replaced-elements/attributes-for-embedded-content-and-images/img_border_percent.xhtml— with no other status changes.css/css-displayandcss/css-tables: per-test statuses identical to main.The body-margin and hspace/vspace mappings have no reftest signal in the runner (the WPT tests covering them are testharness.js-based, which the runner skips, and
body-margin-1/2crash on an unrelated pre-existing iframe issue). I verified those with throwaway local reftests (e.g.<body marginwidth=100 marginheight=30>againstbody { margin: 30px 100px }, and<img hspace=40 vspace=10>againstmargin: 10px 40px): all fail on main and pass with this change.🤖 Generated with Claude Code
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.