public static function html_selector2struc($sel)
    {
        $sc  = '#.:';
        $n   = null;
        $a   = array();
        $def = array('n' => $n, 'i' => $n, 'c' => $a, 'p' => $a);
        $sel = rtrim(trim(preg_replace('/\\s*(>|,)\\s*/', '$1', $sel), " \t\n\r,>"), $sc);
        $sel = explode(',', $sel);
        foreach ($sel as &$a) {
            $a = preg_split('|\\s+|', $a);
            foreach ($a as &$b) {
                $b = explode('>', $b);
                foreach ($b as &$c) {
                    $d = $def;
                    $l = strlen($c);
                    $j = strcspn($c, $sc, 0, $l);
                    if ($j) {
                        $d['n'] = substr($c, 0, $j);
                    }

                    $i = $j;
                    while ($i < $l) {
                        $k = $c[$i++];
                        $j = strcspn($c, $sc, $i, $l);
                        if ($j) {
                            $e = substr($c, $i, $j);
                            switch ($k) {
                                case '.':$d['c'][] = $e;
                                    break;
                                case '#':$d['i'] = $e;
                                    break;
                                case ':':$d['p'][] = self::html_normal_pseudoClass($e);
                                    break;
                            }
                            $i += $j;
                        }
                    }
                    if (empty($d['c'])) {
                        $d['c'] = $n;
                    }

                    if (empty($d['p'])) {
                        $d['p'] = $n;
                    }

                    $c = $d;
                }
            }
        }
        return $sel;
    }