<commit_before>/**
 * Patterns bumper - `bumper' handling for elements
 *
 * Copyright 2012 <NAME>
 * Copyright 2013 <NAME>
 * Copyright 2013-2014 <NAME>.V. - <NAME>
 */
define([
    "jquery",
    "pat-logger",
    "pat-parser",
    "pat-registry"
], function($, logger, Parser, registry) {
    var parser = new Parser("bumper"),
        log = logger.getLogger("bumper");

    parser.add_argument("margin", 0);
    parser.add_argument("selector");
    parser.add_argument("bump-add", "bumped");
    parser.add_argument("bump-remove");
    parser.add_argument("unbump-add");
    parser.add_argument("unbump-remove", "bumped");

    // XXX Handle resize
    var bumper = {
        name: "bumper",
        trigger: ".pat-bumper",

        init: function bumper_init($el, opts) {
            return $el.each(function bumper_initElement() {
                var container = bumper._findScrollContainer(this),
                    $sticker = $(this),
                    options = parser.parse($sticker, opts);
                $sticker.data("pat-bumper:config", options);

                this.style.position="relative";
                if (container===null) {
                    $(window).on("scroll.bumper", null, this, bumper._onScrollWindow);
                    bumper._updateStatus(this);
                } else {
                    if (this.offsetParent!==container) {
                        container.style.position="relative";
                        if (this.offsetParent!==container) {
                            log.error("The offset parent for ", this,
                                      " must be its scrolling container ", container,
                                      "but it is ", this.offsetParent);
                            return;
                        }
                    }
                    $(container).on("scroll.bumper", null, this, bumper._onScrollContainer);<commit_msg>Bumper: preserve old style on init failure.<commit_after>/**
 * Patterns bumper - `bumper' handling for elements
 *
 * Copyright 2012 <NAME>
 * Copyright 2013 <NAME>f
 * Copyright 2013-2014 <NAME>. - <NAME>
 */
define([
    "jquery",
    "pat-logger",
    "pat-parser",
    "pat-registry"
], function($, logger, Parser, registry) {
    var parser = new Parser("bumper"),
        log = logger.getLogger("bumper");

    parser.add_argument("margin", 0);
    parser.add_argument("selector");
    parser.add_argument("bump-add", "bumped");
    parser.add_argument("bump-remove");
    parser.add_argument("unbump-add");
    parser.add_argument("unbump-remove", "bumped");

    // XXX Handle resize
    var bumper = {
        name: "bumper",
        trigger: ".pat-bumper",

        init: function bumper_init($el, opts) {
            return $el.each(function bumper_initElement() {
                var container = bumper._findScrollContainer(this),
                    $sticker = $(this),
                    options = parser.parse($sticker, opts);
                $sticker.data("pat-bumper:config", options);

                this.style.position="relative";
                if (container===null) {
                    $(window).on("scroll.bumper", null, this, bumper._onScrollWindow);
                    bumper._updateStatus(this);
                } else {
                    if (this.offsetParent!==container) {
                        var old_style = container.style.position;
                        container.style.position="relative";
                        if (this.offsetParent!==container) {
                            container.style.position=old_style;
                            log.error("The offset parent for ", this,
                                      " must be its scrolling container ", container,
                                      "but it is ", this.offsetParent);
                            return;
                        }
                    }
                    $(container).on("scroll.bumper", null, this, bumper._onScrollContainer);
{'fraction_non_alphanumeric': 0.1290566037735849, 'fraction_numerical': 0.008553459119496854, 'mean_word_length': 1.6864864864864866, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1602180', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1007, 'n_words': 211}