golf 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/golf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Golf
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -395,6 +395,7 @@ function componentConstructor(name) {
395
395
 
396
396
  if (cmp) {
397
397
  obj._dom = cmp.dom.clone();
398
+ obj._dom.data("_golf_component", obj);
398
399
  obj._dom.data("_golf_constructing", true);
399
400
  obj.require = $fake.require;
400
401
  checkForReservedClass(obj._dom.children().find("*"));
@@ -591,6 +592,11 @@ if (serverside) {
591
592
  $(this).removeData("_golf_prepared");
592
593
  });
593
594
  jss.mark(this);
595
+ $("*", e).each(function(index, elem) {
596
+ var cmp = $(elem).data("_golf_component");
597
+ if (cmp instanceof Component && cmp.onAppend)
598
+ cmp.onAppend();
599
+ });
594
600
  if (a instanceof Component && a.onAppend)
595
601
  a.onAppend();
596
602
  return $(this);
@@ -600,11 +606,19 @@ if (serverside) {
600
606
 
601
607
  $.fn._golf_remove = $.fn.remove;
602
608
  $.fn.remove = function() {
603
- $("*", this).add([this]).each(function() {
609
+ var cmps = [];
610
+ $("*", this).add([this]).each(function(index, elem) {
611
+ var cmp = $(elem).data("_golf_component");
612
+ if (cmp)
613
+ cmps.push({component: cmp, dom: elem});
604
614
  if ($(this).attr("golfid"))
605
615
  $.golf.events[$(this).attr("golfid")] = [];
606
616
  });
607
- return $.fn._golf_remove.call(this);
617
+ var ret = $.fn._golf_remove.call(this);
618
+ $.each(cmps, function(index, item) {
619
+ $(item.dom).data("_golf_component", item.component);
620
+ });
621
+ return ret;
608
622
  };
609
623
 
610
624
  $.each(
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 8
9
- version: 0.3.8
8
+ - 9
9
+ version: 0.3.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Micha Niskin, Alan Dipert, Julio Capote