Skip to content

Commit aee2a46

Browse files
committed
[css-paint-api] Added to explainer the large amount of DOM motivation.
Fixes #341.
1 parent 6ad96b1 commit aee2a46

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

css-paint-api/EXPLAINER.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
CSS Paint API Explained
22
=======================
33

4-
The CSS Paint API is being developered to improve the extensibility of CSS.
4+
The CSS Paint API is being developed to improve the extensibility of CSS.
55

6-
Specifically
6+
Specifically this allows developers to write a paint function which allows us to draw directly into
7+
an elements background, border, or content.
78

9+
This work was motivated for a couple of reasons:
10+
11+
### Reduction of DOM ###
12+
13+
We noticed that developers are using an increasing amount of DOM to create visual effects. As an
14+
example the [<paper-button>](https://www.webcomponents.org/element/PolymerElements/paper-button/paper-button)
15+
uses multiple divs to achieve the "ripple" effect.
16+
17+
Instead of using addition divs the developer could just draw directly into the background-image of
18+
the element instead.
19+
20+
This means that the memory and cpu usage of the page would go down, the rendering engine doesn't
21+
have to keep in memory the additional DOM nodes, in addition to performing style-recalc, layout,
22+
painting for all these additional divs.
23+
24+
### Extensibility of CSS ###
25+
26+
We believe that allowing developers to extend CSS is good for the ecosystem. As an example if a
27+
developer wanted an additional feature they could implement it themselves. E.g. if the developer
28+
wanted a new type of dashed border, they shouldn't have to wait for browsers to implement this.
29+
30+
They should have the power to implement this themselves with the same capability as the rendering
31+
engine.
832

933
Getting Started
1034
---------------

0 commit comments

Comments
 (0)