code wiki / (root) / nx_css_selector_match.nx

nx_css_selector_match.nx

buildroot/runtime/nx_css_selector_match.nx

6027 B165 linesdepth 4pulls 4 transitivereach 100 importersview sourcekind librarytopic css
docsdependenciesstructsconstsfunctions

about

nx_css_selector_match.nx -- match a parsed CssRule selector against an element's (tag, id, class-list). Phase 2 third primitive after nx_css_tokenize and nx_css_parse; the core of the eventual nx_css_apply layer that walks a DOM tree and cascades styles. Subset matched: TAG selector -- exact case-sensitive byte-equal vs element tag CLASS selector -- one of the whitespace-separated tokens in the element's class attribute byte-equal ID selector -- byte-equal vs the element's id attribute What it does NOT handle yet (named Phase 2b improvements): - case-insensitive tag matching for HTML mode (HTML5 lowercases tags; until nx_html_tokenizer normalizes, callers can pre-lowercase) - compound selectors (h1.foo) -- needs Phase 2b - descendant chains (header h1) -- needs DOM-tree context - sibling/child combinators (+ ~ >) - attribute selectors [href^="..."] - pseudo-classes (:hover, :nth-child) - namespace selectors Per cardinal feedback-honest-perf-verdict-no-aspirational-claims: gap list is EXACT and tested. genealogy_id: w3c_css_selectors_module_level_3 + substrate_browser_phase_2_selector_match lineage_id: nishi_browser_css_selector_match_v1 nx_safety_envelope: intended_use: "CSS selector match -- browser front-end style apply" sil_target: SIL1 evidence: [W3C_CSS_Selectors_canonical_basis, sealed_selector_kind_enum, bounded_class_list_walk, pure_function_no_allocation] verdict: NOT_YET_EVALUATED

dependencies 3 imports · 25 importers

nx_syscalls.nx nx_css_tokenize.nx nx_css_parse.nx nx_css_selector_match.nx nx_align_gate.nx nx_css_apply.nx nx_css_apply_test.nx nx_css_boxmap_test.nx nx_css_cascade_test.nx nx_css_extract_test.nx nx_css_selector_match_test.nx nx_flexgrow_gate.nx nx_flexgrow_probe.nx nx_float_gate.nx

diagram shows first 10 each side; +0 more imports, +15 more importers in the complete lists below.

imports: nx_syscalls.nxnx_css_tokenize.nxnx_css_parse.nx

imported by: nx_align_gate.nxnx_css_apply.nxnx_css_apply_test.nxnx_css_boxmap_test.nxnx_css_cascade_test.nxnx_css_extract_test.nxnx_css_selector_match_test.nxnx_flexgrow_gate.nxnx_flexgrow_probe.nxnx_float_gate.nxnx_float_test.nxnx_grid_gate.nxnx_grid_test.nxnx_grid_track_gate.nxnx_justify_gate.nxnx_layout_block.nxnx_layout_block_horizontal_test.nxnx_layout_block_test.nxnx_layout_debug.nxnx_negmargin_gate.nxnx_real_page_gate.nxnx_render_html.nxnx_render_wiki_styled_window.nxnx_table_cell_gate.nxnx_wiki_boxdump.nx

structs

47struct CssElement

consts

57const NX_CSS_ELEMENT_BYTES: i64 = 56

functions

63func _css_bytes_equal(src: *u8, a_off: i64, a_len: i64,
76func _css_is_class_separator(c: i64) -> i64
88func _css_class_list_contains(src: *u8, class_off: i64, class_len: i64,
128func nx_css_element_init(el: *CssElement, src: *u8,
called by 2: mainmain
146func nx_css_selector_match(rule: *CssRule, el: *CssElement) -> i64