Reviewers: MikeSamuel,
Description:
remove duplicate vendorPrefix logic
Please review this at https://codereview.appspot.com/13510043/
Affected files:
M src/com/google/caja/plugin/CssValidator.java
Index: src/com/google/caja/plugin/CssValidator.java
===================================================================
--- src/com/google/caja/plugin/CssValidator.java (revision 5589)
+++ src/com/google/caja/plugin/CssValidator.java (working copy)
@@ -15,6 +15,7 @@
package com.google.caja.plugin;
import com.google.caja.SomethingWidgyHappenedError;
+import com.google.caja.lang.css.CssPropertyPatterns;
import com.google.caja.lang.css.CssSchema;
import com.google.caja.lang.html.HTML;
import com.google.caja.lang.html.HtmlSchema;
@@ -206,7 +207,8 @@
Name.css(prop.getString().substring(1)));
}
if (null == pinfo && prop.getString().startsWith("-")) {
- String baseProp = removeVendorPrefix(prop.getString());
+ String baseProp = CssPropertyPatterns.withoutVendorPrefix(
+ prop.getString());
if (baseProp != null) {
pinfo = cssSchema.getCssProperty(Name.css(baseProp));
}
@@ -252,31 +254,6 @@
return false;
}
- // See the similar function withoutVendorPrefix in sanitizecss.js
- private static String[] vendorPrefixes = {
- "-apple-",
- "-css-",
- "-epub-",
- "-khtml-",
- "-moz-",
- "-ms-",
- "-mso-",
- "-o-",
- "-rim-",
- "-wap-",
- "-webkit-",
- "-xv-",
- };
-
- private static String removeVendorPrefix(String name) {
- for (String prefix : vendorPrefixes) {
- if (name.startsWith(prefix)) {
- return name.substring(prefix.length());
- }
- }
- return null;
- }
-
/** User agent hacks' declarations must be valid. */
private boolean validateUserAgentHack(CssTree.UserAgentHack hack) {
if (hack != null
&& !validatePropertyDeclaration(hack.getDeclaration())) {
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.