rasputin 0.10.5 → 0.10.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Rasputin
2
- VERSION = "0.10.5"
2
+ VERSION = "0.10.7"
3
3
  end
@@ -1,3 +1,4 @@
1
+ (function() {
1
2
  // ==========================================================================
2
3
  // Project: SproutCore - JavaScript Application Framework
3
4
  // Copyright: ©2006-2011 Strobe Inc. and contributors.
@@ -5,8 +6,6 @@
5
6
  // License: Licensed under MIT license (see license.js)
6
7
  // ==========================================================================
7
8
 
8
- require('sproutcore-runtime');
9
-
10
9
  var get = SC.get, set = SC.set;
11
10
 
12
11
  // simple copy op needed for just this code.
@@ -405,7 +404,7 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
405
404
  @returns {Boolean}
406
405
  */
407
406
  isEqual: function(aDateTime) {
408
- return SC.DateTime.compare(this, aDateTime) === 0;
407
+ return this.constructor.compare(this, aDateTime) === 0;
409
408
  },
410
409
 
411
410
  /**
@@ -1013,13 +1012,13 @@ SC.DateTime.reopenClass(SC.Comparable,
1013
1012
  if ( opts.month === 2 && opts.day > 29 ){
1014
1013
  return null;
1015
1014
  }
1016
- if ([4,6,9,11].contains(opts.month) && opts.day > 30) {
1015
+ if (jQuery.inArray(opts.month, [4,6,9,11]) > -1 && opts.day > 30) {
1017
1016
  return null;
1018
1017
  }
1019
1018
  }
1020
1019
  }
1021
1020
 
1022
- d = SC.DateTime.create(opts);
1021
+ d = this.create(opts);
1023
1022
 
1024
1023
  if (!SC.none(check.dayOfWeek) && get(d,'dayOfWeek') !== check.dayOfWeek) {
1025
1024
  return null;
@@ -1175,3 +1174,13 @@ SC.Binding.dateTime = function(format) {
1175
1174
  });
1176
1175
  };
1177
1176
 
1177
+
1178
+ })();
1179
+ (function() {
1180
+ // ==========================================================================
1181
+ // Project: SproutCore DateTime
1182
+ // Copyright: ©2010 Strobe Inc. and contributors
1183
+ // License: Licensed under MIT license (see license.js)
1184
+ // ==========================================================================
1185
+
1186
+ })();
@@ -1710,7 +1710,7 @@ if ('undefined' === typeof require) require = SC.K;
1710
1710
  Inside SproutCore-Metal, simply uses the window.console object.
1711
1711
  Override this to provide more robust logging functionality.
1712
1712
  */
1713
- SC.Logger = window.console;
1713
+ SC.Logger = window.console || { log: SC.K, warn: SC.K, error: SC.K };
1714
1714
 
1715
1715
  })({});
1716
1716
 
@@ -2350,7 +2350,7 @@ function getPath(target, path) {
2350
2350
  var len = path.length, idx, next, key;
2351
2351
 
2352
2352
  idx = path.indexOf('*');
2353
- if (idx>0 && path[idx-1]!=='.') {
2353
+ if (idx>0 && path.charAt(idx-1)!=='.') {
2354
2354
  return getPath(getPath(target, path.slice(0, idx)), path.slice(idx+1));
2355
2355
  }
2356
2356
 
@@ -5983,11 +5983,12 @@ function findNamespaces() {
5983
5983
  if (Namespace.PROCESSED) { return; }
5984
5984
 
5985
5985
  for (var prop in window) {
5986
- if (!window.hasOwnProperty(prop)) { continue; }
5986
+ // Unfortunately, some versions of IE don't support window.hasOwnProperty
5987
+ if (window.hasOwnProperty && !window.hasOwnProperty(prop)) { continue; }
5987
5988
 
5988
5989
  obj = window[prop];
5989
5990
 
5990
- if (obj instanceof Namespace) {
5991
+ if (obj && obj instanceof Namespace) {
5991
5992
  obj[NAME_KEY] = prop;
5992
5993
  }
5993
5994
  }
@@ -8145,7 +8146,7 @@ t.forEach(function(name) {
8145
8146
  var toString = Object.prototype.toString;
8146
8147
 
8147
8148
  /**
8148
- Returns a consistant type for the passed item.
8149
+ Returns a consistent type for the passed item.
8149
8150
 
8150
8151
  Use this instead of the built-in SC.typeOf() to get the type of an item.
8151
8152
  It will return the same result across all browsers and includes a bit
@@ -8160,9 +8161,9 @@ var toString = Object.prototype.toString;
8160
8161
  | 'function' | A function |
8161
8162
  | 'array' | An instance of Array |
8162
8163
  | 'class' | A SproutCore class (created using SC.Object.extend()) |
8163
- | 'object' | A SproutCore object instance |
8164
+ | 'instance' | A SproutCore object instance |
8164
8165
  | 'error' | An instance of the Error object |
8165
- | 'hash' | A JavaScript object not inheriting from SC.Object |
8166
+ | 'object' | A JavaScript object not inheriting from SC.Object |
8166
8167
 
8167
8168
  @param item {Object} the item to check
8168
8169
  @returns {String} the type
@@ -8684,7 +8685,7 @@ SC.Copyable = SC.Mixin.create({
8684
8685
  if (SC.Freezable && SC.Freezable.detect(this)) {
8685
8686
  return get(this, 'isFrozen') ? this : this.copy().freeze();
8686
8687
  } else {
8687
- throw new Error(SC.String.fmt("%@ does not support freezing",this));
8688
+ throw new Error(SC.String.fmt("%@ does not support freezing", [this]));
8688
8689
  }
8689
8690
  }
8690
8691
  });
@@ -10203,14 +10204,14 @@ SC._RenderBuffer = SC.Object.extend(
10203
10204
  @returns {SC.RenderBuffer} this
10204
10205
  */
10205
10206
  addClass: function(className) {
10206
- get(this, 'elementClasses').pushObject(className);
10207
+ get(this, 'elementClasses').addObject(className);
10207
10208
  return this;
10208
10209
  },
10209
10210
 
10210
10211
  /**
10211
10212
  Sets the elementID to be used for the element.
10212
10213
 
10213
- @param {Strign} id
10214
+ @param {String} id
10214
10215
  @returns {SC.RenderBuffer} this
10215
10216
  */
10216
10217
  id: function(id) {
@@ -10672,6 +10673,7 @@ SC.Application = SC.Namespace.extend(
10672
10673
  init: function() {
10673
10674
  var eventDispatcher,
10674
10675
  rootElement = get(this, 'rootElement');
10676
+ this._super();
10675
10677
 
10676
10678
  eventDispatcher = SC.EventDispatcher.create({
10677
10679
  rootElement: rootElement
@@ -10683,6 +10685,8 @@ SC.Application = SC.Namespace.extend(
10683
10685
  SC.$(document).ready(function() {
10684
10686
  self.ready();
10685
10687
  });
10688
+
10689
+ this._super();
10686
10690
  },
10687
10691
 
10688
10692
  ready: function() {
@@ -10836,7 +10840,7 @@ SC.View = SC.Object.extend(
10836
10840
  }
10837
10841
 
10838
10842
  if (!template) {
10839
- throw new SC.Error(fmt('%@ - Unable to find template "%@".', this, templateName));
10843
+ throw new SC.Error(fmt('%@ - Unable to find template "%@".', [this, templateName]));
10840
10844
  }
10841
10845
  }
10842
10846
 
@@ -11113,6 +11117,9 @@ SC.View = SC.Object.extend(
11113
11117
  // If we had previously added a class to the element, remove it.
11114
11118
  if (oldClass) {
11115
11119
  elem.removeClass(oldClass);
11120
+ // Also remove from classNames so that if the view gets rerendered,
11121
+ // the class doesn't get added back to the DOM.
11122
+ classNames.removeObject(oldClass);
11116
11123
  }
11117
11124
 
11118
11125
  // If necessary, add a new class. Make sure we keep track of it so
@@ -11202,8 +11209,9 @@ SC.View = SC.Object.extend(
11202
11209
  passing `isUrgent` to this method will return `"is-urgent"`.
11203
11210
  */
11204
11211
  _classStringForProperty: function(property) {
11205
- var split = property.split(':'), className = split[1];
11206
- property = split[0];
11212
+ var split = property.split(':'),
11213
+ property = split[0],
11214
+ className = split[1];
11207
11215
 
11208
11216
  var val = SC.getPath(this, property);
11209
11217
 
@@ -11215,7 +11223,7 @@ SC.View = SC.Object.extend(
11215
11223
  // Normalize property path to be suitable for use
11216
11224
  // as a class name. For exaple, content.foo.barBaz
11217
11225
  // becomes bar-baz.
11218
- parts = property.split('.');
11226
+ var parts = property.split('.');
11219
11227
  return SC.String.dasherize(parts[parts.length-1]);
11220
11228
 
11221
11229
  // If the value is not NO, undefined, or null, return the current
@@ -11637,7 +11645,7 @@ SC.View = SC.Object.extend(
11637
11645
  this._applyAttributeBindings(buffer);
11638
11646
 
11639
11647
 
11640
- buffer.addClass(get(this, 'classNames').join(' '));
11648
+ get(this, 'classNames').forEach(function(name){ buffer.addClass(name); });
11641
11649
  buffer.id(get(this, 'elementId'));
11642
11650
 
11643
11651
  var role = get(this, 'ariaRole');
@@ -11897,10 +11905,9 @@ SC.View = SC.Object.extend(
11897
11905
  createChildView: function(view, attrs) {
11898
11906
  if (SC.View.detect(view)) {
11899
11907
  view = view.create(attrs || {}, { _parentView: this });
11900
-
11901
- if (attrs && attrs.viewName) {
11902
- set(this, attrs.viewName, view);
11903
- }
11908
+
11909
+ var viewName = attrs && attrs.viewName || view.viewName;
11910
+ if (viewName) { set(this, viewName, view); }
11904
11911
  } else {
11905
11912
  sc_assert('must pass instance of View', view instanceof SC.View);
11906
11913
  set(view, '_parentView', this);
@@ -12489,7 +12496,7 @@ SC.ContainerView.states = {
12489
12496
  // If the DOM element for this container view already exists,
12490
12497
  // schedule each child view to insert its DOM representation after
12491
12498
  // bindings have finished syncing.
12492
- prev = start === 0 ? null : views[start-1];
12499
+ var prev = start === 0 ? null : views[start-1];
12493
12500
 
12494
12501
  for (var i=start; i<start+added; i++) {
12495
12502
  view = views[i];
@@ -12716,6 +12723,225 @@ SC.CollectionView.CONTAINER_MAP = {
12716
12723
  SC.$ = jQuery;
12717
12724
  })({});
12718
12725
 
12726
+ (function(exports) {
12727
+ var get = SC.get, set = SC.set;
12728
+
12729
+ SC.State = SC.Object.extend({
12730
+ isState: true,
12731
+ parentState: null,
12732
+ start: null,
12733
+
12734
+ init: function() {
12735
+ SC.keys(this).forEach(function(name) {
12736
+ var value = this[name];
12737
+
12738
+ if (value && value.isState) {
12739
+ set(value, 'parentState', this);
12740
+ set(value, 'name', (get(this, 'name') || '') + '.' + name);
12741
+ }
12742
+ }, this);
12743
+ },
12744
+
12745
+ enter: SC.K,
12746
+ exit: SC.K
12747
+ });
12748
+
12749
+ })({});
12750
+
12751
+
12752
+ (function(exports) {
12753
+ var get = SC.get, set = SC.set, getPath = SC.getPath, fmt = SC.String.fmt;
12754
+ SC.LOG_STATE_TRANSITIONS = false;
12755
+
12756
+ SC.StateManager = SC.State.extend({
12757
+ /**
12758
+ When creating a new storyboard, look for a default state to transition
12759
+ into. This state can either be named `start`, or can be specified using the
12760
+ `initialState` property.
12761
+ */
12762
+ init: function() {
12763
+ this._super();
12764
+
12765
+ var states = get(this, 'states');
12766
+ if (!states) {
12767
+ states = {};
12768
+ SC.keys(this).forEach(function(name) {
12769
+ var value = get(this, name);
12770
+
12771
+ if (value && value.isState) {
12772
+ states[name] = value;
12773
+ }
12774
+ }, this);
12775
+
12776
+ set(this, 'states', states);
12777
+ }
12778
+
12779
+ var initialState = get(this, 'initialState');
12780
+
12781
+ if (!initialState && get(this, 'start')) {
12782
+ initialState = 'start';
12783
+ }
12784
+
12785
+ if (initialState) {
12786
+ this.goToState(initialState);
12787
+ }
12788
+ },
12789
+
12790
+ currentState: null,
12791
+
12792
+ send: function(event, context) {
12793
+ this.sendRecursively(event, get(this, 'currentState'), context);
12794
+ },
12795
+
12796
+ sendRecursively: function(event, currentState, context) {
12797
+ var log = SC.LOG_STATE_TRANSITIONS;
12798
+
12799
+ var action = currentState[event];
12800
+
12801
+ if (action) {
12802
+ if (log) { console.log(fmt("STORYBOARDS: Sending event '%@' to state %@.", [event, currentState.name])); }
12803
+ action.call(currentState, this, context);
12804
+ } else {
12805
+ var parentState = get(currentState, 'parentState');
12806
+ if (parentState) { this.sendRecursively(event, parentState, context); }
12807
+ }
12808
+ },
12809
+
12810
+ goToState: function(name) {
12811
+ var currentState = get(this, 'currentState') || this, state, newState;
12812
+
12813
+ var exitStates = SC.A();
12814
+
12815
+ newState = getPath(currentState, name);
12816
+ state = currentState;
12817
+
12818
+ if (!newState) {
12819
+ while (state && !newState) {
12820
+ exitStates[SC.guidFor(state)] = state;
12821
+ exitStates.push(state)
12822
+
12823
+ state = get(state, 'parentState')
12824
+ if (!state) {
12825
+ state = get(this, 'states');
12826
+ }
12827
+ newState = getPath(state, name);
12828
+ }
12829
+ }
12830
+
12831
+ this.enterState(state, name, exitStates);
12832
+ },
12833
+
12834
+ getState: function(name) {
12835
+ var state = get(this, name),
12836
+ parentState = get(this, 'parentState');
12837
+
12838
+ if (state) {
12839
+ return state;
12840
+ } else if (parentState) {
12841
+ return parentState.getState(name);
12842
+ }
12843
+ },
12844
+
12845
+ asyncEach: function(list, callback, doneCallback) {
12846
+ var async = false, self = this;
12847
+
12848
+ if (!list.length) {
12849
+ if (doneCallback) { doneCallback.call(this); }
12850
+ return;
12851
+ }
12852
+
12853
+ var head = list[0];
12854
+ var tail = list.slice(1);
12855
+
12856
+ var transition = {
12857
+ async: function() { async = true; },
12858
+ resume: function() {
12859
+ self.asyncEach(tail, callback, doneCallback);
12860
+ }
12861
+ }
12862
+
12863
+ callback.call(this, head, transition);
12864
+
12865
+ if (!async) { transition.resume(); }
12866
+ },
12867
+
12868
+ enterState: function(parent, name, exitStates) {
12869
+ var log = SC.LOG_STATE_TRANSITIONS;
12870
+
12871
+ var parts = name.split("."), state = parent, enterStates = SC.A();
12872
+
12873
+ parts.forEach(function(name) {
12874
+ state = state[name];
12875
+
12876
+ var guid = SC.guidFor(state);
12877
+
12878
+ if (guid in exitStates) {
12879
+ exitStates.removeObject(state);
12880
+ delete exitStates[guid];
12881
+ } else {
12882
+ enterStates.push(state);
12883
+ }
12884
+ });
12885
+
12886
+ var stateManager = this;
12887
+
12888
+ this.asyncEach(exitStates, function(state, transition) {
12889
+ state.exit(stateManager, transition);
12890
+ }, function() {
12891
+ this.asyncEach(enterStates, function(state, transition) {
12892
+ if (log) { console.log("STORYBOARDS: Entering " + state.name); }
12893
+ state.enter(stateManager, transition);
12894
+ }, function() {
12895
+ var startState = state, enteredState;
12896
+
12897
+ // right now, start states cannot be entered asynchronously
12898
+ while (startState = get(startState, 'start')) {
12899
+ enteredState = startState;
12900
+ startState.enter(stateManager);
12901
+ }
12902
+
12903
+ set(this, 'currentState', enteredState || state);
12904
+ });
12905
+ });
12906
+ }
12907
+ });
12908
+
12909
+ })({});
12910
+
12911
+
12912
+ (function(exports) {
12913
+ var get = SC.get, set = SC.set;
12914
+
12915
+ SC.ViewState = SC.State.extend({
12916
+ enter: function(stateManager) {
12917
+ var view = get(this, 'view');
12918
+
12919
+ if (view) {
12920
+ view.appendTo(stateManager.get('rootElement') || 'body');
12921
+ }
12922
+ },
12923
+
12924
+ exit: function(stateManager) {
12925
+ var view = get(this, 'view');
12926
+
12927
+ if (view) {
12928
+ view.remove();
12929
+ }
12930
+ }
12931
+ });
12932
+
12933
+
12934
+ })({});
12935
+
12936
+
12937
+ (function(exports) {
12938
+ // ==========================================================================
12939
+ // Project: SproutCore Storyboards
12940
+ // Copyright: ©2011 Living Social Inc. and contributors.
12941
+ // License: Licensed under MIT license (see license.js)
12942
+ // ==========================================================================
12943
+ })({});
12944
+
12719
12945
  (function(exports) {
12720
12946
  // ==========================================================================
12721
12947
  // Project: metamorph
@@ -12726,9 +12952,20 @@ SC.$ = jQuery;
12726
12952
 
12727
12953
  var K = function(){},
12728
12954
  guid = 0,
12955
+ document = window.document,
12956
+
12957
+ // Feature-detect the W3C range API, the extended check is for IE9 which only partially supports ranges
12958
+ supportsRange = ('createRange' in document) && (typeof Range !== 'undefined') && Range.prototype.createContextualFragment,
12729
12959
 
12730
- // Feature-detect the W3C range API
12731
- supportsRange = ('createRange' in document);
12960
+ // Internet Explorer prior to 9 does not allow setting innerHTML if the first element
12961
+ // is a "zero-scope" element. This problem can be worked around by making
12962
+ // the first node an invisible text node. We, like Modernizr, use &shy;
12963
+ needsShy = (function(){
12964
+ var testEl = document.createElement('div');
12965
+ testEl.innerHTML = "<div></div>";
12966
+ testEl.firstChild.innerHTML = "<script></script>";
12967
+ return testEl.firstChild.innerHTML === '';
12968
+ })();
12732
12969
 
12733
12970
  // Constructor that supports either Metamorph('foo') or new
12734
12971
  // Metamorph('foo');
@@ -12741,7 +12978,7 @@ SC.$ = jQuery;
12741
12978
  if (this instanceof Metamorph) {
12742
12979
  self = this;
12743
12980
  } else {
12744
- self = new K;
12981
+ self = new K();
12745
12982
  }
12746
12983
 
12747
12984
  self.innerHTML = html;
@@ -12756,8 +12993,6 @@ SC.$ = jQuery;
12756
12993
 
12757
12994
  var rangeFor, htmlFunc, removeFunc, outerHTMLFunc, appendToFunc, startTagFunc, endTagFunc;
12758
12995
 
12759
- // create the outer HTML for the current metamorph. this function will be
12760
- // extended by the Internet Explorer version to work around a bug.
12761
12996
  outerHTMLFunc = function() {
12762
12997
  return this.startTag() + this.innerHTML + this.endTag();
12763
12998
  };
@@ -12773,6 +13008,17 @@ SC.$ = jQuery;
12773
13008
  // If we have the W3C range API, this process is relatively straight forward.
12774
13009
  if (supportsRange) {
12775
13010
 
13011
+ // IE 9 supports ranges but doesn't define createContextualFragment
13012
+ if (!Range.prototype.createContextualFragment) {
13013
+ Range.prototype.createContextualFragment = function(html) {
13014
+ var frag = document.createDocumentFragment(),
13015
+ div = document.createElement("div");
13016
+ frag.appendChild(div);
13017
+ div.outerHTML = html;
13018
+ return frag;
13019
+ };
13020
+ }
13021
+
12776
13022
  // Get a range for the current morph. Optionally include the starting and
12777
13023
  // ending placeholders.
12778
13024
  rangeFor = function(morph, outerToo) {
@@ -12848,30 +13094,36 @@ SC.$ = jQuery;
12848
13094
  *
12849
13095
  * We need to do this because innerHTML in IE does not really parse the nodes.
12850
13096
  **/
12851
- function firstNodeFor(parentNode, html) {
13097
+ var firstNodeFor = function(parentNode, html) {
12852
13098
  var arr = wrapMap[parentNode.tagName.toLowerCase()] || wrapMap._default;
12853
- var depth = arr[0], start = arr[1], end = arr[2];
13099
+ var depth = arr[0], start = arr[1], end = arr[2];
13100
+
13101
+ if (needsShy) { html = '&shy;'+html; }
12854
13102
 
12855
- var element = document.createElement('div');
13103
+ var element = document.createElement('div');
12856
13104
  element.innerHTML = start + html + end;
12857
13105
 
12858
13106
  for (var i=0; i<=depth; i++) {
12859
13107
  element = element.firstChild;
12860
13108
  }
12861
13109
 
12862
- return element;
12863
- }
13110
+ // Look for &shy; to remove it.
13111
+ if (needsShy) {
13112
+ var shyElement = element;
12864
13113
 
12865
- /**
12866
- * Internet Explorer does not allow setting innerHTML if the first element
12867
- * is a "zero-scope" element. This problem can be worked around by making
12868
- * the first node an invisible text node. We, like Modernizr, use &shy;
12869
- **/
12870
- var startTagFuncWithoutShy = startTagFunc;
13114
+ // Sometimes we get nameless elements with the shy inside
13115
+ while (shyElement.nodeType === 1 && !shyElement.nodeName && shyElement.childNodes.length === 1) {
13116
+ shyElement = shyElement.firstChild;
13117
+ }
12871
13118
 
12872
- startTagFunc = function() {
12873
- return "&shy;" + startTagFuncWithoutShy.call(this);
12874
- }
13119
+ // At this point it's the actual unicode character.
13120
+ if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
13121
+ shyElement.nodeValue = shyElement.nodeValue.slice(1);
13122
+ }
13123
+ }
13124
+
13125
+ return element;
13126
+ };
12875
13127
 
12876
13128
  /**
12877
13129
  * In some cases, Internet Explorer can create an anonymous node in
@@ -12885,7 +13137,7 @@ SC.$ = jQuery;
12885
13137
  * node and use *it* as the marker.
12886
13138
  **/
12887
13139
  var realNode = function(start) {
12888
- while (start.parentNode.tagName == "") {
13140
+ while (start.parentNode.tagName === "") {
12889
13141
  start = start.parentNode;
12890
13142
  }
12891
13143
 
@@ -12931,17 +13183,15 @@ SC.$ = jQuery;
12931
13183
  var start = realNode(document.getElementById(this.start));
12932
13184
  var end = document.getElementById(this.end);
12933
13185
  var parentNode = end.parentNode;
12934
- var nextSibling, last;
13186
+ var node, nextSibling, last;
12935
13187
 
12936
13188
  // make sure that the start and end nodes share the same
12937
13189
  // parent. If not, fix it.
12938
13190
  fixParentage(start, end);
12939
13191
 
12940
- var node = start;
12941
- if (!outerToo) { node = node.nextSibling; }
12942
-
12943
13192
  // remove all of the nodes after the starting placeholder and
12944
13193
  // before the ending placeholder.
13194
+ node = start.nextSibling;
12945
13195
  while (node) {
12946
13196
  nextSibling = node.nextSibling;
12947
13197
  last = node === end;
@@ -13264,7 +13514,7 @@ SC.TextSupport = SC.Mixin.create({
13264
13514
  },
13265
13515
 
13266
13516
  _elementValueDidChange: function() {
13267
- set(this, 'value', this.$().val() || null);
13517
+ set(this, 'value', this.$().val() || '');
13268
13518
  }
13269
13519
 
13270
13520
  });
@@ -13324,12 +13574,15 @@ SC.Button = SC.View.extend(SC.TargetActionSupport, {
13324
13574
  attributeBindings: ['type', 'disabled'],
13325
13575
  type: 'button',
13326
13576
  disabled: false,
13327
-
13577
+ propagateEvents: false,
13328
13578
 
13329
13579
  mouseDown: function() {
13330
- set(this, 'isActive', true);
13331
- this._mouseDown = true;
13332
- this._mouseEntered = true;
13580
+ if (!get(this, 'disabled')) {
13581
+ set(this, 'isActive', true);
13582
+ this._mouseDown = true;
13583
+ this._mouseEntered = true;
13584
+ }
13585
+ return get(this, 'propagateEvents');
13333
13586
  },
13334
13587
 
13335
13588
  mouseLeave: function() {
@@ -13357,6 +13610,7 @@ SC.Button = SC.View.extend(SC.TargetActionSupport, {
13357
13610
 
13358
13611
  this._mouseDown = false;
13359
13612
  this._mouseEntered = false;
13613
+ return get(this, 'propagateEvents');
13360
13614
  },
13361
13615
 
13362
13616
  // TODO: Handle proper touch behavior. Including should make inactive when
@@ -13959,11 +14213,17 @@ SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
13959
14213
  // determine which class string to return, based on whether it is
13960
14214
  // a Boolean or not.
13961
14215
  var classStringForProperty = function(property) {
14216
+ var split = property.split(':'),
14217
+ property = split[0],
14218
+ className = split[1];
14219
+
13962
14220
  var val = getPath(context, property);
13963
14221
 
13964
14222
  // If value is a Boolean and true, return the dasherized property
13965
14223
  // name.
13966
14224
  if (val === YES) {
14225
+ if (className) { return className; }
14226
+
13967
14227
  // Normalize property path to be suitable for use
13968
14228
  // as a class name. For exaple, content.foo.barBaz
13969
14229
  // becomes bar-baz.
@@ -13984,7 +14244,7 @@ SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
13984
14244
 
13985
14245
  // For each property passed, loop through and setup
13986
14246
  // an observer.
13987
- classBindings.split(' ').forEach(function(property) {
14247
+ classBindings.split(' ').forEach(function(binding) {
13988
14248
 
13989
14249
  // Variable in which the old class value is saved. The observer function
13990
14250
  // closes over this variable, so it knows which string to remove when
@@ -13997,13 +14257,13 @@ SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
13997
14257
  // class name.
13998
14258
  observer = function() {
13999
14259
  // Get the current value of the property
14000
- newClass = classStringForProperty(property);
14260
+ newClass = classStringForProperty(binding);
14001
14261
  elem = id ? view.$("[data-handlebars-id='" + id + "']") : view.$();
14002
14262
 
14003
14263
  // If we can't find the element anymore, a parent template has been
14004
14264
  // re-rendered and we've been nuked. Remove the observer.
14005
14265
  if (elem.length === 0) {
14006
- SC.removeObserver(context, property, invoker);
14266
+ SC.removeObserver(context, binding, invoker);
14007
14267
  } else {
14008
14268
  // If we had previously added a class to the element, remove it.
14009
14269
  if (oldClass) {
@@ -14025,11 +14285,12 @@ SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
14025
14285
  SC.run.once(observer);
14026
14286
  };
14027
14287
 
14288
+ property = binding.split(':')[0];
14028
14289
  SC.addObserver(context, property, invoker);
14029
14290
 
14030
14291
  // We've already setup the observer; now we just need to figure out the
14031
14292
  // correct behavior right now on the first pass through.
14032
- value = classStringForProperty(property);
14293
+ value = classStringForProperty(binding);
14033
14294
 
14034
14295
  if (value) {
14035
14296
  ret.push(value);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rasputin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.5
4
+ version: 0.10.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-30 00:00:00.000000000Z
12
+ date: 2011-12-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70186645512240 !ruby/object:Gem::Requirement
16
+ requirement: &70127501464920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70186645512240
24
+ version_requirements: *70127501464920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: actionpack
27
- requirement: &70186645511700 !ruby/object:Gem::Requirement
27
+ requirement: &70127501464420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70186645511700
35
+ version_requirements: *70127501464420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sprockets
38
- requirement: &70186645511120 !ruby/object:Gem::Requirement
38
+ requirement: &70127501463960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70186645511120
46
+ version_requirements: *70127501463960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jquery-rails
49
- requirement: &70186645510520 !ruby/object:Gem::Requirement
49
+ requirement: &70127501463500 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '1.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70186645510520
57
+ version_requirements: *70127501463500
58
58
  description: SproutCore 2.0 for the Rails asset pipeline.
59
59
  email:
60
60
  - paul@chavard.net