<commit_before>// ==========================================================================
// Project:   SproutCore Handlebar Views
// Copyright: ©2011 Strobe Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*globals Handlebars */

require('sproutcore-handlebars/ext');
require('sproutcore-handlebars/views/bindable_span');
require('sproutcore-handlebars/views/metamorph_view');

var get = SC.get, getPath = SC.getPath, set = SC.set, fmt = SC.String.fmt;

(function() {
  // Binds a property into the DOM. This will create a hook in DOM that the
  // KVO system will look for and upate if the property changes.
  var bind = function(property, options, preserveContext, shouldDisplay) {
    var data = options.data,
        fn = options.fn,
        inverse = options.inverse,
        view = data.view,
        ctx  = this;

    // Set up observers for observable objects
    if ('object' === typeof this) {
      // Create the view that will wrap the output of this template/property 
      // and add it to the nearest view's childViews array.
      // See the documentation of SC._BindableSpanView for more.
      var bindView = view.createChildView(SC._BindableSpanView, {
        preserveContext: preserveContext,
        shouldDisplayFunc: shouldDisplay,
        displayTemplate: fn,
        inverseTemplate: inverse,
        property: property,
        previousContext: ctx,
        isEscaped: options.hash.escaped
      });

      view.appendChild(bindView);

      var observer, invoker;

      observer = function(){
        // Double check since sometimes the view gets destroyed after this observer is already queued
        if (!get(bindView, 'isDestroyed')) { bindView.rerender(); }
      };

      invoker = function() {
        SC.run.once(observer);
      };

      // Observes the given property on the context and
      // tells the SC._BindableSpan to re-render. If property
      // is an empty string, we are printing the current context
      // object ({{this}}) so updating it is not our responsibility.
      if (property !== '') {
        set(bindView, 'removeObserver', function() {
          SC.removeObserver(ctx, property, invoker);
        });

        SC.addObserver(ctx, property, invoker);<commit_msg>Remove overriding removeObserver on bind views.<commit_after>// ==========================================================================
// Project:   SproutCore Handlebar Views
// Copyright: ©2011 Strobe Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*globals Handlebars */

require('sproutcore-handlebars/ext');
require('sproutcore-handlebars/views/bindable_span');
require('sproutcore-handlebars/views/metamorph_view');

var get = SC.get, getPath = SC.getPath, set = SC.set, fmt = SC.String.fmt;

(function() {
  // Binds a property into the DOM. This will create a hook in DOM that the
  // KVO system will look for and upate if the property changes.
  var bind = function(property, options, preserveContext, shouldDisplay) {
    var data = options.data,
        fn = options.fn,
        inverse = options.inverse,
        view = data.view,
        ctx  = this;

    // Set up observers for observable objects
    if ('object' === typeof this) {
      // Create the view that will wrap the output of this template/property 
      // and add it to the nearest view's childViews array.
      // See the documentation of SC._BindableSpanView for more.
      var bindView = view.createChildView(SC._BindableSpanView, {
        preserveContext: preserveContext,
        shouldDisplayFunc: shouldDisplay,
        displayTemplate: fn,
        inverseTemplate: inverse,
        property: property,
        previousContext: ctx,
        isEscaped: options.hash.escaped
      });

      view.appendChild(bindView);

      var observer, invoker;

      observer = function(){
        // Double check since sometimes the view gets destroyed after this observer is already queued
        if (!get(bindView, 'isDestroyed')) { bindView.rerender(); }
      };

      invoker = function() {
        SC.run.once(observer);
      };

      // Observes the given property on the context and
      // tells the SC._BindableSpan to re-render. If property
      // is an empty string, we are printing the current context
      // object ({{this}}) so updating it is not our responsibility.
      if (property !== '') {
        SC.addObserver(ctx, property, invoker);
{'fraction_non_alphanumeric': 0.15925363419396832, 'fraction_numerical': 0.0017357344326318074, 'mean_word_length': 2.950299914310197, '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': '5995932', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1151, 'n_words': 402}