protected function updateSelector()
    {
        $buffer = implode('', $this->getBuffer());
        $qtiClassMap = ($this->isWebComponentFriendly()) ? array_merge(self::$qtiClassMapping, self::$wcFriendlyQtiClassMapping) : self::$qtiClassMapping;

        if (strpos($buffer, ',') === false) {

            // Do not rescope if already scoped!
            if (strpos($buffer, '#' . $this->getId()) === false) {
                $buffer = ($this->doesMapQtiClasses() === true) ? CssUtils::mapSelector($buffer, $qtiClassMap) : $buffer;
                $buffer = ($this->doesMapQtiPseudoClasses() === true) ? CssUtils::mapPseudoClasses($buffer, self::getQtiPseudoClassMapping()) : $buffer;
                $this->output('#' . $this->getId() . ' ' . $buffer . '{');
            } else {
                $buffer = ($this->doesMapQtiPseudoClasses() === true) ? CssUtils::mapPseudoClasses($buffer, self::getQtiPseudoClassMapping()) : $buffer;
                $this->output($buffer . '{');
            }
        } else {
            $classes = explode(',', $buffer);
            $newClasses = array();

            foreach ($classes as $c) {

                // Same as above, do not rescope if already scoped...
                if (strpos($c, '#' . $this->getId()) === false) {
                    $c = ($this->doesMapQtiClasses() === true) ? CssUtils::mapSelector($c, $qtiClassMap) : $c;
                    $newC =  '#' . $this->getId() . ' ' . trim($c);
                    $newC = str_replace(trim($c), $newC, $c);
                } else {
                    $newC = $c;
                }

                $newClasses[] = $newC;
            }

            $buffer = implode(',', $newClasses);
            $buffer = ($this->doesMapQtiPseudoClasses() === true) ? CssUtils::mapPseudoClasses($buffer, self::getQtiPseudoClassMapping()) : $buffer;
            $this->output($buffer . '{');
        }
    }
protected function updateSelector()
    {
        $buffer = implode('', $this->getBuffer());
        $qtiClassMap = ($this->isWebComponentFriendly()) ? array_merge(self::$qtiClassMapping, self::$wcFriendlyQtiClassMapping) : self::$qtiClassMapping;

        if (strpos($buffer, ',') === false) {

            // Do not rescope if already scoped!
            if (strpos($buffer, '#' . $this->getId()) === false) {
                $buffer = ($this->doesMapQtiClasses() === true) ? CssUtils::mapSelector($buffer, $qtiClassMap) : $buffer;
                $buffer = ($this->doesMapQtiPseudoClasses() === true) ? CssUtils::mapPseudoClasses($buffer, self::getQtiPseudoClassMapping()) : $buffer;
                $this->output('#' . $this->getId() . ' ' . $buffer . '{');
            } else {
                $buffer = ($this->doesMapQtiPseudoClasses() === true) ? CssUtils::mapPseudoClasses($buffer, self::getQtiPseudoClassMapping()) : $buffer;
                $this->output($buffer . '{');
            }
        } else {
            $classes = explode(',', $buffer);
            $newClasses = array();

            foreach ($classes as $c) {

                // Same as above, do not rescope if already scoped...
                if (strpos($c, '#' . $this->getId()) === false) {
                    $c = ($this->doesMapQtiClasses() === true) ? CssUtils::mapSelector($c, $qtiClassMap) : $c;
                    $newC =  '#' . $this->getId() . ' ' . trim($c);
                    $newC = str_replace(trim($c), $newC, $c);
                } else {
                    $newC = $c;
                }

                $newClasses[] = $newC;
            }

            $buffer = implode(',', $newClasses);
            $buffer = ($this->doesMapQtiPseudoClasses() === true) ? CssUtils::mapPseudoClasses($buffer, self::getQtiPseudoClassMapping()) : $buffer;
            $this->output($buffer . '{');
        }
    }
protected function updateSelector ( ) { $ buffer = implode ( '' , $ this -> getBuffer ( ) ) ; $ qtiClassMap = ( $ this -> isWebComponentFriendly ( ) ) ? array_merge ( self :: $ qtiClassMapping , self :: $ wcFriendlyQtiClassMapping ) : self :: $ qtiClassMapping ; if ( strpos ( $ buffer , ',' ) === false ) { // Do not rescope if already scoped! if ( strpos ( $ buffer , '#' . $ this -> getId ( ) ) === false ) { $ buffer = ( $ this -> doesMapQtiClasses ( ) === true ) ? CssUtils :: mapSelector ( $ buffer , $ qtiClassMap ) : $ buffer ; $ buffer = ( $ this -> doesMapQtiPseudoClasses ( ) === true ) ? CssUtils :: mapPseudoClasses ( $ buffer , self :: getQtiPseudoClassMapping ( ) ) : $ buffer ; $ this -> output ( '#' . $ this -> getId ( ) . ' ' . $ buffer . '{' ) ; } else { $ buffer = ( $ this -> doesMapQtiPseudoClasses ( ) === true ) ? CssUtils :: mapPseudoClasses ( $ buffer , self :: getQtiPseudoClassMapping ( ) ) : $ buffer ; $ this -> output ( $ buffer . '{' ) ; } } else { $ classes = explode ( ',' , $ buffer ) ; $ newClasses = array ( ) ; foreach ( $ classes as $ c ) { // Same as above, do not rescope if already scoped... if ( strpos ( $ c , '#' . $ this -> getId ( ) ) === false ) { $ c = ( $ this -> doesMapQtiClasses ( ) === true ) ? CssUtils :: mapSelector ( $ c , $ qtiClassMap ) : $ c ; $ newC = '#' . $ this -> getId ( ) . ' ' . trim ( $ c ) ; $ newC = str_replace ( trim ( $ c ) , $ newC , $ c ) ; } else { $ newC = $ c ; } $ newClasses [ ] = $ newC ; } $ buffer = implode ( ',' , $ newClasses ) ; $ buffer = ( $ this -> doesMapQtiPseudoClasses ( ) === true ) ? CssUtils :: mapPseudoClasses ( $ buffer , self :: getQtiPseudoClassMapping ( ) ) : $ buffer ; $ this -> output ( $ buffer . '{' ) ; } }
Update selector implementation.

Update the currently processed CSS selector by prefixing it
with the appropriate id.
Update selector implementation .