Timtech4u / gwtquery

Automatically exported from code.google.com/p/gwtquery
MIT License
0 stars 0 forks source link

attr(Properties properties): will not work if property has function #154

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In gquery1.2.0, seems attr(Properties properties) only take care of string 
value, in fact i see it supports function value as well. Below code will not 
work for "title" attribute:

        Properties p = Properties.create( "rel: 'external'" );
        p.set( "title", new Function()
        {
            @Override
            public Object f( Element e, int i )
            {
                return "Learn more about " + $( this ).text() + " at Wikipedia";
            }
        } );
        $( "div a" ).attr( p );

Original issue reported on code.google.com by julyg...@gmail.com on 2 Oct 2012 at 2:26

GoogleCodeExporter commented 9 years ago

Original comment by julien.d...@gmail.com on 8 Oct 2012 at 7:47

GoogleCodeExporter commented 9 years ago
The method is not thought to evaluate the function and set the returned value 
to the property, but to wrap a java function into a native js function which 
will be assigned to the property.

It is useful for exporting/importing js apis, the exported version of gquery 
(jsquery) uses it.

We will not change the current behavior, just document the method so as the 
developer knows exactly what this method does.

Thanks

Original comment by manuel.carrasco.m on 10 Dec 2012 at 9:36

GoogleCodeExporter commented 9 years ago
see revision 901c8420e18e5ca971f4a208a91204d4934eaa9f

Original comment by manuel.carrasco.m on 10 Dec 2012 at 9:39