Executes the strategy on the tokens. 
                                                        {
        $definition = 
$config->getHTMLDefinition();
        $escape_invalid_tags = 
$config->get(
'Core.EscapeInvalidTags');
        $remove_invalid_img  = 
$config->get(
'Core.RemoveInvalidImg');
        
        $trusted = 
$config->get(
'HTML.Trusted');
        $remove_script_contents = 
$config->get(
'Core.RemoveScriptContents');
        $hidden_elements     = 
$config->get(
'Core.HiddenElements');
        
        if ($remove_script_contents === true) {
            $hidden_elements['script'] = true;
        } elseif ($remove_script_contents === false && isset($hidden_elements['script'])) {
            unset($hidden_elements['script']);
        }
        
        $remove_until = false;
        
        $textify_comments = false;
        $token = false;
        $context->register('CurrentToken', $token);
        $e = false;
        if (
$config->get(
'Core.CollectErrors')) {
 
            $e =& $context->get('ErrorCollector');
        }
        foreach($tokens as $token) {
            if ($remove_until) {
                if (empty($token->is_tag) || $token->name !== $remove_until) {
                    continue;
                }
            }
            if (!empty( $token->is_tag )) {
                
                
                if (
                    isset($definition->info_tag_transform[$token->name])
                ) {
                    $original_name = $token->name;
                    
                    
                    $token = $definition->
                                info_tag_transform[$token->name]->
                                    transform($token, 
$config, $context);
                    if ($e) $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Tag transform', $original_name);
                }
                if (isset($definition->info[$token->name])) {
                    
                    
                    if (
                        $definition->info[$token->name]->required_attr &&
                        ($token->name != 'img' || $remove_invalid_img) 
                    ) {
                        $attr_validator->validateToken($token, 
$config, $context);
                        foreach ($definition->info[$token->name]->required_attr as $name) {
                            if (!isset($token->attr[$name])) {
                                break;
                            }
                        }
                            if ($e) $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Missing required attribute', $name);
                            continue;
                        }
                        $token->armor['ValidateAttributes'] = true;
                    }
                        $textify_comments = $token->name;
                        $textify_comments = false;
                    }
                } elseif ($escape_invalid_tags) {
                    
                    if ($e) $e->send(E_WARNING, 'Strategy_RemoveForeignElements: Foreign element to text');
                        $generator->generateFromToken($token)
                    );
                } else {
                    
                    
                    if (isset($hidden_elements[$token->name])) {
                            $remove_until = $token->name;
                        } elseif ($token instanceof HTMLPurifier_Token_Empty) {
                            
                        } else {
                            $remove_until = false;
                        }
                        if ($e) $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Foreign meta element removed');
                    } else {
                        if ($e) $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Foreign element removed');
                    }
                    continue;
                }
                
                if ($textify_comments !== false) {
                } elseif ($trusted) {
                    
                    if ($e) {
                        
                        if (substr($token->data, -1) == '-') {
                            $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Trailing hyphen in comment removed');
                        }
                    }
                    $token->data = rtrim($token->data, '-');
                    $found_double_hyphen = false;
                    while (strpos($token->data, '--') !== false) {
                        if ($e && !$found_double_hyphen) {
                            $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Hyphens in comment collapsed');
                        }
                        $found_double_hyphen = true; 
                        $token->data = str_replace('--', '-', $token->data);
                    }
                } else {
                    
                    if ($e) $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Comment removed');
                    continue;
                }
            } else {
                continue;
            }
        }
        if ($remove_until && $e) {
            
            $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Token removed to end', $remove_until);
        }
        $context->destroy('CurrentToken');
    }