Open
Description
API Initialization Performance
CssChain
is serving css query which could return any html element including custom elements (Web Components) in NodeSet. It means the API should cover all of them. In general it is possible as HTML elements are known and custom elements are available from registry. It looks impractical to initialize the API on each CssChain() call, not to mention on each chain operations CssChain().a().b()
. Instead the united API could be preserved in CssChain prototype.
API prototype life cycle
potential options:
- module load - initial pre-population for standard HTML elements, not all custom elements are loaded
- dom loaded event - as lazy load option
- worker thread - immediately upon module loaded, the web components registry most likely is not available
- each instantiation - going over 1st element prototype chain and skipping already applied and each object member. The 1st element is taken in assumption that result set comprise similar( with identical members) objects.
The last option should be efficient overall as applied API during module load would not need the merge again as the following calls with same object types.