Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -967,9 +967,6 @@ public AttributeBuilder matching(
*/
@SuppressWarnings("synthetic-access")
public HtmlPolicyBuilder globally() {
if (attributeNames.contains("style")) {
allowStyling();
}
return HtmlPolicyBuilder.this.allowAttributesGlobally(
policy, attributeNames);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,17 +541,6 @@ public static final void testOptionAllowsText() {
pf.sanitize(input)
);
}

@Test
public static final void testStyleGlobally() {
PolicyFactory policyBuilder = new HtmlPolicyBuilder()
.allowAttributes("style").globally()
.allowElements("a", "label", "h1", "h2", "h3", "h4", "h5", "h6")
.toFactory();
String input = "<h1 style=\"color:green ;name:user ;\">This is some green text</h1>";
String want = "<h1 style=\"color:green\">This is some green text</h1>";
assertEquals(want, policyBuilder.sanitize(input));
}

static int fac(int n) {
int ifac = 1;
Expand Down