Revision: 6509
Author: b...@google.com
Date: Wed Oct 28 09:08:06 2009
Log: Edited wiki page through web user interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=6509

Modified:
  /wiki/CssResource.wiki

=======================================
--- /wiki/CssResource.wiki      Mon Oct 19 16:08:21 2009
+++ /wiki/CssResource.wiki      Wed Oct 28 09:08:06 2009
@@ -407,6 +407,30 @@
    * To allow for client-side tweaking of the effective (i.e.  
permutation-specific) style rules, you can store the value of  
CssResource.getText() into a TextArea.  Wire some UI action to pass the  
contents of the TextArea into `StyleInjector.setContents()` to overwrite  
the original, injected stylesheet.

  = Selector obfuscation details =
+
+== Strict scoping ==
+
+In the normal case, any class selectors that do not match String accessor  
functions is an error.  This behavior can be disabled by adding a  
`...@notstrict` annotation to the CSS accessor method.  Enabling 
`...@notstrict`  
behavior is only recommended for applications that are transitioning from  
external CSS files to CssResource.
+
+{{{
+interface MyCssResource extends CssResource {
+  String foo();
+}
+
+interface Resources {
+  @Source("my.css")
+  @CssResource.NotStrict
+  MyCssResource css();
+}
+}}}
+{{{
+/* This is ok */
+.foo {}
+
+/* This would normally generate a compile error in strict mode */
+.other {}
+}}}
+
  == Scope ==
  Scoping of obfuscated class names is defined by the return type of the  
CssResource accessor method in the resource bundle.  Each distinct return  
type will return a wholly separate collection of values for String accessor  
methods.

@@ -537,12 +561,10 @@

  interface Resources {
    @Source("stackPanel.css")
-  @Strict
    StackPanelInner inner();

    @Import(StackPanelInner.class)
    @Source("stackPanel.css", "outer.css")
-  @Strict
    StackPanelOuter outer();
  }
  }}}
@@ -563,33 +585,6 @@
    font-size: smaller;
  }
  }}}
-
-== Strict scoping ==
-
-In the normal case, any class selectors that do not match String accessor  
functions are left unobfuscated in the compiled output.
-
-{{{
-interface MyCssResource extends CssResource {
-  String foo();
-}
-
-interface Resources {
-  @Strict
-  @Source("my.css")
-  MyCssResource css();
-}
-}}}
-{{{
-/* This is ok */
-.foo {}
-
-/* This would generate a compile error in @Strict mode */
-.other {}
-}}}
-
-The `...@strict` annotation can be applied to a CssResource accessor function  
to make it a compile-time error to have any unobfuscated class selectors in  
the CSS file.  This additional level of restriction is recommended for  
library-oriented resource bundles in order to avoid inadvertently polluting  
the global CSS namespace.
-
-Strict scoping can be forced on for all CssResources by adding  
`<set-configuration-property name="CssResource.strictAccessors"  
value="true" />` to the module XML file, however this is only recommended  
for use by applications or test modules and never in any module that will  
be redistributed.

  == External and legacy scopes ==

@@ -603,7 +598,6 @@

  interface Resource extends ClientBundle {
    @Source("my.css")
-  @Strict
    MyCssResource css();
  }
  }}}
@@ -613,7 +607,7 @@
  .obfuscated .legacySelectorB { .... }
  }}}

-In the above example, the `.obfuscated` class selector will be obfuscated,  
and the `obfuscated()` method will return the replaced name. Neither of the  
legacy selectors will be obfuscated and the `legacySelectorA()` method will  
return the unobfuscated value.  Furthermore, because the `legacySelectorB`  
is explicitly defined in the `...@external` declaration, the `...@strict`  
annotation will not trigger an error.
+In the above example, the `.obfuscated` class selector will be obfuscated,  
and the `obfuscated()` method will return the replaced name. Neither of the  
legacy selectors will be obfuscated and the `legacySelectorA()` method will  
return the unobfuscated value.  Furthermore, because the `legacySelectorB`  
is explicitly defined in the `...@external` declaration, the inaccessible  
class name will not trigger an error.

  == Automatically generating CssResource interfaces ==


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to