<br><br><div class="gmail_quote">On Sun, Dec 14, 2008 at 10:15 PM, Stefan Behnel <span dir="ltr"><<a href="mailto:stefan_ml@behnel.de">stefan_ml@behnel.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<div><div></div><div class="Wj3C7c"><br>
Olivier Lauzanne wrote:<br>
> I have implemented some of the classes that are present in jQuery but not in<br>
> the css standard. Extending the classes seems like the right way to do it.<br>
> You can check it out here.<br>
><br>
> <a href="http://www.bitbucket.org/olauzanne/pyquery/src/tip/pyquery/cssselectpatch.py" target="_blank">http://www.bitbucket.org/olauzanne/pyquery/src/tip/pyquery/cssselectpatch.py</a><br>
><br>
> cssselect should remain standard compliant but I could make a patch so that<br>
> using the jQuery pseudo classes is an option of the CSSSelector class. I<br>
> don't have a strong opinion about doing it or not doing it. What do you<br>
> think ?<br>
<br>
</div></div>Would it make sense to make this a separate module like "jqselect" (which<br>
would inherit most of the API of cssselect) instead of patching into<br>
cssselect itself?<br>
<font color="#888888"><br>
Stefan<br>
<br>
</font></blockquote></div>It's possible but not simple. I would have to add a parameter on most functions down to parse_simple_selector for it to use some specific Pseudo and Function classes. Or else I would have to do some major refactoring : putting most functions in a class and using self.Pseudo and self.Function instead of Pseudo and Function. That would be the nicest I think.<br>
<br>Then the JQueryPseudo and JQueryFunction classes could be put in a different file.<br><br>Anyway I have to patch cssselect if I don't want to duplicate code (which I don't want), either with a monkey patch or by modifying cssselect. The most simple is definitly monkey patching. But it's not the safest in the long term.<br>
<br>Olivier<br>