CSS Parser Runtime Customization via Segment Parsing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional approaches to rendering web pages require significant increases in CSS and HTML code size for customization, leading to performance issues and difficulties in caching, especially when customizations are browser-specific, and existing CSS parsers lack efficiency in performance, maintainability, and selective parsing at runtime.

Innovation Solution

A CSS parser engineered for runtime usage that allows for customizable segments of the CSS codebase to be accessed and transformed, using a two-level parsing strategy and plugins for vendor prefixing and dynamic AST creation, enabling efficient parsing and customization of CSS code for improved maintainability and performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If conventional approaches append additional CSS or HTML style attributes to customize web pages, then customization capability is improved, but code size increases making caching difficult

Engineering Contradiction:
Improvecustomization capabilityVSAvoidcode size
Core Design Contradiction:
Adaptability or versatilityVSWeight of stationary object

Solution Approach 1:

The CSS codebase is divided into customizable segments with target tokens that can be selectively transformed. Instead of modifying entire CSS files, only specific segments containing target tokens are parsed and customized at runtime, reducing the overall code size that needs to be transmitted and cached.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Target tokens are extracted from the CSS codebase into customizable segments. These segments are separated from the main CSS file and can be independently transformed and injected, allowing customization without increasing the base code size.

Inventive Principle:
Principle #2Taking out (Extraction)

2Adaptability or versatility

If conventional CSS parsers are used for runtime customization, then parsing functionality is provided, but performance deteriorates due to lack of selective parsing efficiency

Engineering Contradiction:
Improveruntime customizationVSAvoidparsing performance
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The parsing process is segmented into two levels: first identifying customizable segments containing target tokens, then selectively parsing only those segments at runtime. This avoids parsing the entire CSS codebase, significantly improving performance while maintaining runtime customization capability.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Instead of parsing the complete CSS codebase, the system performs partial parsing by identifying and processing only the customizable segments that contain target tokens. This partial action approach maintains runtime customization while dramatically reducing parsing overhead.

Inventive Principle:
Principle #16Partial or excessive action

3Adaptability or versatility

If entire HTML pages are passed from backend to client when CSS changes are made, then customization is achieved, but transmission time and bandwidth consumption increase

Engineering Contradiction:
Improvecustomization flexibilityVSAvoidpage transmission time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

Customizable CSS segments are extracted from the main HTML page and transmitted separately. When customizations are needed, only these specific segments are updated and injected into the client-side cache, avoiding the need to retransmit the entire HTML page and reducing transmission time.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The CSS codebase is pre-processed to identify and segment customizable portions containing target tokens. This preliminary segmentation enables efficient runtime customization where only necessary segments are transmitted and applied, rather than sending complete pages.

Inventive Principle:
Principle #10Preliminary action

4Device complexity

If fixed input grammar is used in CSS parsers, then parsing simplicity is maintained, but adaptability to different customization requirements is reduced

Engineering Contradiction:
Improveparser simplicityVSAvoidcustomization flexibility
Core Design Contradiction:
Device complexityVSAdaptability or versatility

Solution Approach 1:

The parser uses a dynamic grammar structure that can adapt to different customization requirements. The grammar is not fixed but can be extended through plugins and custom transformations, allowing the parser to handle various CSS patterns and target tokens while maintaining a relatively simple base structure.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The CSS parser is designed with universal functionality to handle multiple customization scenarios. By using a flexible grammar that can recognize and process different target tokens and CSS patterns, a single parser can serve multiple customization needs without requiring separate fixed grammars for each case.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS10489497B2Fast CSS parser
Publication Date: 2019.11.26 SALESFORCE INC
  • US10489497B2 patent drawing
  • US10489497B2 patent drawing
  • US10489497B2 patent drawing

AI summary

The technology disclosed relates to systems and methods for providing a CSS parser to improve the maintainability of code that displays data to users. The technology disclosed also improves the performance and consistency of the code that delivers a user's experience. An embodiment operates by accessing a CSS target token in a first customizable code segment and scanning a CSS codebase to locate a second customizable code segment of the CSS codebase that comprises the target token. Embodiments may further include transforming an object in the first or second customizable code segments of the CSS codebase by modifying the first or second customizable code segments to include customization code, parsing the first and second customizable code segments by transforming the first or second customizable code segments of the CSS codebase into a plurality of segment parse trees, and outputting a customized codebase based on the plurality of segment parse trees.