Support for safe external scripts via explicit whitelist.
[htmlpurifier.git] / docs / proposal-css-extraction.txt
blob9933c96b8f0297d7fac6a8656eace6c67fea3b1f
2 Extracting inline CSS from HTML Purifier
3     voodoofied: Assigning semantics to elements
5 Sander Tekelenburg brought to my attention the poor programming style of
6 inline CSS in HTML documents.  In an ideal world, we wouldn't be using inline
7 CSS at all: everything would be assigned using semantic class attributes
8 from an external stylesheet.
10 With ExtractStyleBlocks and CSSTidy, this is now possible (when allowed, users
11 can specify a style element which gets extracted from the user-submitted HTML, which
12 the application can place in the head of the HTML document).  But there still
13 is the issue of inline CSS that refuses to go away.
15 The basic idea behind this feature is assign every element a unique identifier,
16 and then move all of the CSS data to a style-sheet. This HTML:
18 <div style="text-align:center">Big <span style="color:red;">things</span>!</div>
20 into
22 <div id="hp-12345">Big <span id="hp-12346">things</span>!</div>
24 and a stylesheet that is:
26 #hp-12345 {text-align:center;}
27 #hp-12346 {color:red;}
29 Beyond that, HTML Purifier can magically merge common CSS values together,
30 and a whole manner of other heuristic things.  HTML Purifier should also
31 make it easy for an admin to re-style the HTML semantically. Speed is not
32 an issue. Also, better WYSIWYG editors are needed.
34     vim: et sw=4 sts=4