diacainiao / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

R298 selector "> *" doosn't work #77

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. $myDOM->find('body > *');
2.
3.

What is the expected output? What do you see instead?
Should match all the direct children of the body element. Instead of that
it doesn't match anything.

What version of the product are you using? On what operating system?
R298

Please provide any additional information below.
Work before R29x

Original issue reported on code.google.com by nicolas....@gmail.com on 7 Nov 2008 at 5:10

GoogleCodeExporter commented 8 years ago
On the same element $myDOM->find('body')->children() return the element I want.

Original comment by nicolas....@gmail.com on 7 Nov 2008 at 5:13

GoogleCodeExporter commented 8 years ago
Couldn't reproduce it. Please attach problematic HTML code.
phpQuery::newDocumentFile('http://google.com/')->find('body > *')->dumpWhois();

Original comment by tobiasz....@gmail.com on 7 Nov 2008 at 11:44

GoogleCodeExporter commented 8 years ago
So, first.
<php>$masque_DOM->find('body > *')->dumpWhois();</php> give me an empty array.
<php>$masque_DOM->find('body')->children()->dumpWhois();</php> give me that :
array(2) {
  [0]=>
  string(28) "ul#contenu_navigation_outils"
  [1]=>
  string(18) "div#contenu_volets"
}

$masque_DOM is loaded with the DOM :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta http-equiv="Content-Language" content="fr" />
    </head>
    <body>
        <div id="contenu_volets">
            <div id="contenu_voletGauche">
                <div id="contenu_navigation" class="bloc_arrondi blanc_10_10 administrable">
                    <div class="bloc_arrondi_haut">
                        <div class="bloc_arrondi_haut_gauche"></div>
                        <div class="bloc_arrondi_haut_droit"></div>
                    </div>
                    <div class="bloc_arrondi_centre">
                        <div class="bloc_arrondi_centre1">
                            <div class="bloc_arrondi_centre2 bloc_contenu administrable_contenu"></div>
                        </div>
                    </div>
                    <div class="bloc_arrondi_bas">
                        <div class="bloc_arrondi_bas_gauche"></div>
                        <div class="bloc_arrondi_bas_droit"></div>
                    </div>
                </div>
            </div>
            <div id="contenu_voletDroit">
                <div id="contenu_article" class="bloc_arrondi grisDegrade_10_10_341 administrable
redimensionnable">
                    <div class="bloc_arrondi_haut">
                        <div class="bloc_arrondi_haut_gauche"></div>
                        <div class="bloc_arrondi_haut_droit"></div>
                    </div>
                    <div class="bloc_arrondi_centre">
                        <div class="bloc_arrondi_centre1">
                            <div class="bloc_arrondi_centre2 bloc_contenu administrable_contenu
WAI_element-40-WAI_principal-30 WAI_contenu">
                                <p class="contenu_filAriane justifier_non">
                                    Vous êtes ici : <span class="filAriane_contenu"></span>
                                </p>
                                <h1 id="IDcmsRef-page-titre">Editorial</h1>
                                <div id="IDcmsTag_article"></div>
                                <div class="nettoyeur"></div>
                            </div>
                        </div>
                    </div>
                    <div class="bloc_arrondi_bas">
                        <div class="bloc_arrondi_bas_gauche"></div>
                        <div class="bloc_arrondi_bas_droit"></div>
                    </div>
                </div>
            </div>
            <div id="contenu_voletPied"></div>
        </div>
    </body>
</html>

Original comment by nicolas....@gmail.com on 10 Nov 2008 at 10:14

GoogleCodeExporter commented 8 years ago
using <php>$masque_DOM->find('body:first')->children();</pre> I'll get that :
<pre>Array
(
    [0] => FIND
    [1] => body:first
    [2] => Array
        (
            [0] => Array
                (
                    [0] =>  
                    [1] => body
                    [2] => :first
                )

        )

)
</pre>
<pre>XPATH: //*[local-name()='body']</pre>
<pre>QUERY FETCHED</pre>
<pre>Matched 1: body</pre>

using <php>$masque_DOM->find('body:first > *');</pre> I'll get that :
<pre>Array
(
    [0] => FIND
    [1] => body:first > *
    [2] => Array
        (
            [0] => Array
                (
                    [0] =>  
                    [1] => body
                    [2] => :first
                    [3] => >
                    [4] => *
                )

        )

)
</pre>
<pre>XPATH: //*[local-name()='body']</pre>
<pre>QUERY FETCHED</pre>
<pre>Matched 1: body</pre>
<pre>XPATH:
/*[local-name()='html'][1]/*[local-name()='body'][1]/*[local-name()='*']</pre>
<pre>QUERY FETCHED</pre>

<pre>Nothing found</pre>

Original comment by nicolas....@gmail.com on 10 Nov 2008 at 11:20

GoogleCodeExporter commented 8 years ago
Fixed in r299. Only XML docs were affected.

Original comment by tobiasz....@gmail.com on 10 Nov 2008 at 11:33