Examples of JavaScriptStripper


Examples of org.apache.wicket.core.util.string.JavaScriptStripper

   * @see org.apache.wicket.javascript.IJavaScriptCompressor#compress(java.lang.String)
   */
  @Override
  public String compress(String original)
  {
    return new JavaScriptStripper().stripCommentsAndWhitespace(original);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

{
  /**   */
  @Test
  public void unixWICKET501()
  {
    String s = new JavaScriptStripper().stripCommentsAndWhitespace("    // Handle the common XPath // expression\n    if ( !t.indexOf(\"//\") ) {");
    assertEquals(" \n if ( !t.indexOf(\"//\") ) {", s);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void dosWICKET501()
  {
    String s = new JavaScriptStripper().stripCommentsAndWhitespace("    // Handle the common XPath // expression\r\n    if ( !t.indexOf(\"//\") ) {");
    assertEquals(" \r\nif ( !t.indexOf(\"//\") ) {", s);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void macWICKET501()
  {
    String s = new JavaScriptStripper().stripCommentsAndWhitespace("    // Handle the common XPath // expression\r    if ( !t.indexOf(\"//\") ) {");
    assertEquals(" \r if ( !t.indexOf(\"//\") ) {", s);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void regexp()
  {
    String s = new JavaScriptStripper().stripCommentsAndWhitespace("    t = jQuery.trim(t).replace( /^\\/\\//i, \"\" );");
    assertEquals(" t = jQuery.trim(t).replace( /^\\/\\//i, \"\" );", s);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void regexp2()
  {
    String s = new JavaScriptStripper().stripCommentsAndWhitespace("foo.replace(/\"//*strip me*/, \"\"); // strip me\rdoFoo();");
    assertEquals("foo.replace(/\"/, \"\"); \rdoFoo();", s);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void regexp3()
  {
    String s = new JavaScriptStripper().stripCommentsAndWhitespace("parseFloat( elem.filter.match(/alpha\\(opacity=(.*)\\)/)[1] ) / 100 : 1;\r//foo");
    assertEquals("parseFloat( elem.filter.match(/alpha\\(opacity=(.*)\\)/)[1] ) / 100 : 1;\r",
      s);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void regexp4()
  {
    String before = " attr: /**/ //xyz\n /\\[((?:[\\w-]*:)?[\\w-]+)\\s*(?:([!^$*~|]?=)\\s*((['\"])([^\\4]*?)\\4|([^'\"][^\\]]*?)))?\\]/    after     regex";
    String after = new JavaScriptStripper().stripCommentsAndWhitespace(before);
    String expected = " attr:  \n /\\[((?:[\\w-]*:)?[\\w-]+)\\s*(?:([!^$*~|]?=)\\s*((['\"])([^\\4]*?)\\4|([^'\"][^\\]]*?)))?\\]/ after regex";
    assertEquals(expected, after);
    System.out.println(after);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void WICKET1806()
  {
    String before = "a = [ /^(\\[) *@?([\\w-]+) *([!*$^~=]*) *('?\"?)(.*?)\\4 *\\]/ ];    b()";
    String after = new JavaScriptStripper().stripCommentsAndWhitespace(before);
    String expected = "a = [ /^(\\[) *@?([\\w-]+) *([!*$^~=]*) *('?\"?)(.*?)\\4 *\\]/ ]; b()";

    assertEquals(expected, after);
  }
View Full Code Here

Examples of org.apache.wicket.core.util.string.JavaScriptStripper

  /**   */
  @Test
  public void WICKET2060_1()
  {
    String before = "   a   b   c";
    String after = new JavaScriptStripper().stripCommentsAndWhitespace(before);
    String expected = " a b c";
    assertEquals(expected, after);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.