dodotis / gwtquery

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

Add support for jQuery pseudo-selectors #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Implements all jquery pseudo-selectors (like :first, :last, :visible, :hidden, 
:odd, :even)  in GwtQuery.

Original issue reported on code.google.com by julien.d...@gmail.com on 26 May 2011 at 11:45

GoogleCodeExporter commented 9 years ago
Issue 85 has been merged into this issue.

Original comment by julien.d...@gmail.com on 26 May 2011 at 11:47

GoogleCodeExporter commented 9 years ago
Issue 71 has been merged into this issue.

Original comment by julien.d...@gmail.com on 26 May 2011 at 11:47

GoogleCodeExporter commented 9 years ago
Issue 79 has been merged into this issue.

Original comment by julien.d...@gmail.com on 26 May 2011 at 11:47

GoogleCodeExporter commented 9 years ago
Is there any status update on where this work stands?  Seems like "necessary" 
functionality for the project to be useful :) 

Original comment by rstud...@gmail.com on 7 Jul 2011 at 12:53

GoogleCodeExporter commented 9 years ago
I know where the problem is. Will be fixed for the next release

Original comment by julien.d...@gmail.com on 8 Jul 2011 at 8:11

GoogleCodeExporter commented 9 years ago
Those selectors are not css2 standars, gquery already supports most of them via 
the SelectorEngineSizzle, you have two options to use it:

1.- by program:
SelectorEngineImpl selSizzle = new SelectorEngineSizzle();
GQuery g = $(selSizzle.select("option:first", e));

2.- or changing the default implementation of the engine in your module file:

<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzle">
  <when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
  <any>
   <when-property-is name="user.agent" value="gecko1_8"/>
   <when-property-is name="user.agent" value="opera"/>
   <when-property-is name="user.agent" value="safari"/>
  </any>
</replace-with>

Note that gquery prefers native and xpath selectors implementations in order to 
reduce the amount of the final javascript code (about 20K) since most 
applications does not use these set of selectors.

- Manolo

Original comment by manuel.carrasco.m on 8 Jul 2011 at 3:55

GoogleCodeExporter commented 9 years ago
I think that if jquery support these selectors, gwtquery should support it also 
without special manipulation of the developer.

they are two fixes possible :

-Quick fix : sizzle support all of pseudo selectors, so we can test if the 
selector contains a pseudo-selector and use SelectorEngineSizzle in these case. 
(we already do that in SelectorEngineNative/SelectorEngineNativeIE8 for some 
pseudo-selector)

-I think that is possible to modify the xpath selector to handle these pseudo 
selectors and transform them in xpath operation

What do you think ?

Original comment by julien.d...@gmail.com on 9 Jul 2011 at 9:09

GoogleCodeExporter commented 9 years ago
#1 is easier but implies to add Sizzle stuff to all applications even if it is 
using css2 only selectors. With this solution we could remove xpath engine 
since sizzle could be the default.

#2 we have to implement a set of regular expressions to transform pseudo to 
xpath, I'm more in this way.

btw: :hidden and :visible are not supported in sizzle

Original comment by manuel.carrasco.m on 12 Jul 2011 at 6:56

GoogleCodeExporter commented 9 years ago
- added :first :last :even :odd in r728 although it is faster to use their css2 
equivalents :nth-child(1) :nth-last-child(1) :nth-child(even) :nth-child(odd).

- :visible and :hidden are especial cases in jquery see 
http://docs.jquery.com/Release:jQuery_1.3.2#:visible.2F:hidden_Overhauled, and 
it is better not to use them in selectors but in filters. I think we could 
implement visible() and hidden() methods.

Original comment by manuel.carrasco.m on 12 Jul 2011 at 8:56

GoogleCodeExporter commented 9 years ago
r755 closes this issue.

Original comment by manuel.carrasco.m on 29 Jul 2011 at 5:55