Skip to content

Commit 1207446

Browse files
committed
add a way to disable property name suggestion, needs to add aproperty in the servlet
1 parent d84a4d7 commit 1207446

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

org/w3c/css/parser/CssPropertyFactory.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,14 @@ public synchronized CssProperty createProperty(ApplContext ac, AtRule atRule, St
237237
throw new InvalidParamException("noexistence", new String[]{property, ac.getMsg().getString(ac.getPropertyKey()), pfsOk.toString()}, ac);
238238
}
239239
} else {
240-
String possibleName = findClosestPropertyName(atRule, ac, property);
241-
if (possibleName != null) {
242-
throw new InvalidParamException("noexistence-typo", new String[]{property, possibleName}, ac);
240+
if (ac.getSuggestPropertyName()) {
241+
String possibleName = findClosestPropertyName(atRule, ac, property);
242+
if (possibleName != null) {
243+
throw new InvalidParamException("noexistence-typo", new String[]{property, possibleName}, ac);
243244

244-
} else {
245-
throw new InvalidParamException("noexistence-at-all", property, ac);
245+
}
246246
}
247+
throw new InvalidParamException("noexistence-at-all", property, ac);
247248
}
248249
}
249250

org/w3c/css/util/ApplContext.java

+9
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class ApplContext {
7171
int warningLevel = 0;
7272
boolean treatVendorExtensionsAsWarnings = false;
7373
boolean treatCssHacksAsWarnings = false;
74+
boolean suggestPropertyName = true;
7475

7576
private String propertyKey = null;
7677

@@ -316,6 +317,14 @@ public void setTreatCssHacksAsWarnings(boolean treatCssHacksAsWarnings) {
316317
this.treatCssHacksAsWarnings = treatCssHacksAsWarnings;
317318
}
318319

320+
public boolean getSuggestPropertyName() {
321+
return suggestPropertyName;
322+
}
323+
324+
public void setSuggestPropertyName(boolean b) {
325+
suggestPropertyName = b;
326+
}
327+
319328
/**
320329
* Sets the content encoding to the first charset that appears in
321330
* <i>acceptCharset</i>. If the charset is not supported, the content

0 commit comments

Comments
 (0)