<commit_before>import Observer from './Observer.js';

/**
 * Handles details and summary elements
 */
export default class DetailsObserver extends Observer {
    /**
     * @inheritDoc
     */
    observe(ev) {
        ev.forEach(item => item.addedNodes.forEach(node => {
            if (node instanceof HTMLDetailsElement) {
                this.initDetails(node);
            } else if (node instanceof HTMLElement) {
                node.querySelectorAll('details').forEach(item => this.initDetails(item));
            }
        }));
    }

    /**<commit_msg>Handle directly added summary elements for completeness although this case is de facto not needed<commit_after>import Observer from './Observer.js';

/**
 * Handles details and summary elements
 */
export default class DetailsObserver extends Observer {
    /**
     * @inheritDoc
     */
    observe(ev) {
        ev.forEach(item => item.addedNodes.forEach(node => {
            if (node instanceof HTMLDetailsElement) {
                this.initDetails(node);
            } else if (node instanceof HTMLElement && node.tagName.toLowerCase() === 'summary') {
                this.initSummary(node);
            } else if (node instanceof HTMLElement) {
                node.querySelectorAll('details').forEach(item => this.initDetails(item));
            }
        }));
    }

    /**
{'fraction_non_alphanumeric': 0.11795252225519288, 'fraction_numerical': 0.0, 'mean_word_length': 2.258454106280193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '240671', 'n_tokens_mistral': 341, 'n_tokens_neox': 338, 'n_words': 84}