<commit_before>import Ember from 'ember';
import setScrollClassName from 'ghost/utils/set-scroll-classname';

var PostContentView = Ember.View.extend({
    classNames: ['content-preview-content'],

    didInsertElement: function () {
        var el = this.$();
        el.on('scroll', Ember.run.bind(el, setScrollClassName, {
            target: el.closest('.content-preview'),
            offset: 10
        }));
    },

    contentObserver: function () {
        this.$().closest('.content-preview').scrollTop(0);
    }.observes('controller.content'),

    willDestroyElement: function () {
        var el = this.$();
        el.off('scroll');
    }
});

export default PostContentView;<commit_msg>Only attempt to `scrollTop` if element is available.<commit_after>import Ember from 'ember';
import setScrollClassName from 'ghost/utils/set-scroll-classname';

var PostContentView = Ember.View.extend({
    classNames: ['content-preview-content'],

    didInsertElement: function () {
        var el = this.$();
        el.on('scroll', Ember.run.bind(el, setScrollClassName, {
            target: el.closest('.content-preview'),
            offset: 10
        }));
    },

    contentObserver: function () {
        var el = this.$();

        if (el) {
            el.closest('.content-preview').scrollTop(0);
        }
    }.observes('controller.content'),

    willDestroyElement: function () {
        var el = this.$();
        el.off('scroll');
    }
});

export default PostContentView;
{'fraction_non_alphanumeric': 0.15472203616878769, 'fraction_numerical': 0.004018754186202277, 'mean_word_length': 2.6798029556650245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7054696', 'n_tokens_mistral': 433, 'n_tokens_neox': 420, 'n_words': 87}