Skip to main content

Detecting Redundant CSS Rules in HTML5: A Tree-Rewriting Approach

Anthony Lin ( Yale-NUS College, Singapore )

HTML5 applications normally have a large set of CSS (Cascading Style Sheets) rules for data display.  Each CSS rule consists of a node selector and a declaration block (assigning values to selected nodes' display attributes).  As web applications evolve, maintaining CSS files can easily become problematic.  Some CSS rules will be replaced by new ones, but these obsolete (hence redundant) CSS rules often remain in the applications.  Not only does this "bloat" the applications, but it also increases web browsers' processing time and download time.  Most works on detecting redundant CSS rules in HTML5 applications do not consider the dynamic behaviours of HTML5 (specified in JavaScript); in fact, the only available method that takes these into account is dynamic analysis (aka testing), which cannot soundly prove redundancy of CSS rules.  In this talk, I will describe a static analysis technique based on a monotonic tree-rewriting abstraction of HTML5 applications.  The algorithm relies on an efficient reduction to an analysis of symbolic pushdown systems (for which highly optimised solvers are available, e.g. Moped and Bebop), which yields a fast method for checking CSS redundancy in practice.  We have implemented a proof-of-concept prototype, TreePed, and our preliminary experimental results have been promising.  I will present these and compare TreePed with existing tools.

This is a work that has recently been provisionally accepted at OOPSLA, joint with Matthew Hague (Royal Holloway, University of London) and Luke Ong (University of Oxford).

Speaker biography

Dr Anthony Lin is an assistant professor in computer science at Yale-NUS College.  He completed his PhD at Edinburgh's University School of Informatics under Prof Leonid Libkin and Dr Richard Mayr.  Previously, he was an EPSRC Postdoctoral Research Fellow at Oxford University (2010-13) in Prof Marta Kwiatkowska's group.  His current research focuses on program analysis for the web and algorithmic program verification.

Share this: