<commit_before><?php
/*
Copyright 2015 Lcf.vs
Copyright © 2008 - 2009 <NAME> <<EMAIL>>
 -
Released under the MIT license
 -
https://github.com/Lcfvs/PHPDOM
*/
namespace PHPDOM\HTML;

trait SelectorTrait
{
    public function select($selector)
    {
        $node_list = $this->selectAll($selector);

        if ($node_list instanceof NodeList) {
            return $node_list->item(0);
        }
    }

    public function selectAll($selector)
    {
        $query = self::_parse($selector);

        if ($this instanceof DocumentFragment) {
            $query = '/' . $query;
        }

        $node_list = $this->ownerDocument->xpath->evaluate($query, $this);

        if ($node_list instanceof \DOMNodeList) {
            return new NodeList($node_list);<commit_msg>Fix for DocumentFragment selectors<commit_after><?php
/*
Copyright 2015 Lcf.vs
Copyright © 2008 - 2009 <NAME> <<EMAIL>>
 -
Released under the MIT license
 -
https://github.com/Lcfvs/PHPDOM
*/
namespace PHPDOM\HTML;

trait SelectorTrait
{
    public function select($selector)
    {
        $node_list = $this->selectAll($selector);

        if ($node_list instanceof NodeList) {
            return $node_list->item(0);
        }
    }

    public function selectAll($selector)
    {
        $query = self::_parse($selector);
        
        $node_list = $this->ownerDocument->xpath->evaluate($query, $this);

        if ($node_list instanceof \DOMNodeList) {
            return new NodeList($node_list);
{'fraction_non_alphanumeric': 0.1309362279511533, 'fraction_numerical': 0.017639077340569877, 'mean_word_length': 2.6151960784313726, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5248646', 'n_tokens_mistral': 470, 'n_tokens_neox': 441, 'n_words': 100}