Skip to content

Commit ec52376

Browse files
0xflotusmikesamuel
authored andcommitted
Fixed Lambda of ElementPolicy in doc (#168)
* Changed/Fixed Lambda to anonymous class of ElementPolicy in doc * Update client-side-templates.md * Update client-side-templates.md * Update client-side-templates.md * Update README.md * Remove unnecessary curly bracket and dedent body
1 parent c88ddf4 commit ec52376

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,12 @@ to do things like changing `h1`s to `div`s with a certain class:
6666
PolicyFactory policy = new HtmlPolicyBuilder()
6767
.allowElements("p")
6868
.allowElements(
69-
new ElementPolicy() {
70-
(String elementName, List<String> attrs) -> {
71-
// Add a class attribute.
72-
attrs.add("class");
73-
attrs.add("header-" + elementName);
74-
// Return elementName to include, null to drop.
75-
return "div";
76-
}
69+
(String elementName, List<String> attrs) -> {
70+
// Add a class attribute.
71+
attrs.add("class");
72+
attrs.add("header-" + elementName);
73+
// Return elementName to include, null to drop.
74+
return "div";
7775
}, "h1", "h2", "h3", "h4", "h5", "h6")
7876
.toFactory();
7977
String safeHTML = policy.sanitize(untrustedHTML);

docs/client-side-templates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Many client-side templates look for special constructs in text nodes. Often, us
2222

2323
## Client side template / expression attributes
2424

25-
When filtering client-side templates, it should also be considered to fully cover attributes containing expressions and parseable information that might cause damage or lead to arbitary JavaScript execution.
25+
When filtering client-side templates, it should also be considered to fully cover attributes containing expressions and parseable information that might cause damage or lead to arbitrary JavaScript execution.
2626

2727
| Template Language | Attrbutes | Notes |
2828
|-------------------|-----------|-------|

0 commit comments

Comments
 (0)