Revision: 5597
Author: [email protected]
Date: Tue Sep 17 21:35:17 2013 UTC
Log: remove duplicate vendorPrefix logic
https://codereview.appspot.com/13510043
R=mikesamuel
http://code.google.com/p/google-caja/source/detail?r=5597
Modified:
/trunk/src/com/google/caja/plugin/CssValidator.java
=======================================
--- /trunk/src/com/google/caja/plugin/CssValidator.java Wed Aug 28 18:22:02
2013 UTC
+++ /trunk/src/com/google/caja/plugin/CssValidator.java Tue Sep 17 21:35:17
2013 UTC
@@ -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));
}
@@ -251,31 +253,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) {
--
---
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.