Skip to main navigation Skip to search Skip to main content

A Domain-Specific Language for Testing CSS Layouts in the Browser

  • Christopher Nobis

    Student thesis: Master's Thesis

    Abstract

    The web stack offers ample means of producing a layout, but no standard vocabu
    lary for stating expectations about the result. This thesis designs and implements
    layout-lint, a browser-native JavaScript library in which developers state layout rules
    in a domain-specific language and evaluate them directly in the browser. The cen
    tral research question is whether a small declarative language can cover the classes
    of layout bugs documented in the empirical literature. The relevant state of the
    art consists of several tools built for testing layout. Established approaches such as
    Galen Framework and BackstopJS run as a separate process outside the browser,
    whereas layout-lint runs inside the page under test. To read and process the layout
    descriptions, a parser is created by means of the parser generator Tree-sitter. The
    parser has to meet two essential requirements: error recovery, because developers
    write the layout specification themselves and a mistake must not stop the parse
    before it can be reported, and extensibility, so that adding new rules requires only
    a change to the grammar definition, from which the parser can be regenerated. The
    syntax of the language is defined as a context-free grammar. The GLR parser gen
    erated from it is compiled to WebAssembly and yields a syntax tree even for faulty
    input, from which the library derives its diagnostics. The language describes the
    position, size, visibility, text and CSS properties of elements, and their count. The
    runtime component of the library checks every rule against the geometry and the
    styling of the rendered page and triggers a re-evaluation on every DOM change. A
    widget embedded in the page shows the results, provides an editor for the specifi
    cation, and informs developers about faults. An evaluation of the finished library
    on purpose-built demo pages shows that it detects a range of the layout bugs docu
    mented in the literature.
    Date of Award2026
    Original languageEnglish (American)
    Awarding Institution
    • FH OÖ
    SupervisorJohannes Alexander Karder (Supervisor)

    Studyprogram

    • Software Engineering

    Cite this

    '