Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

implement removeChild()

  • Loading branch information...
commit 4b338ec325d13cb30476559a5258895373219b6d 1 parent fd6022c
Tom Preston-Werner authored October 25, 2008

Showing 1 changed file with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. 16  primer.js
16  primer.js
@@ -64,6 +64,11 @@ Primer.prototype = {
64 64
     this.draw()
65 65
   },
66 66
   
  67
+  removeChild: function(child) {
  68
+    this.root.removeChild(child)
  69
+    this.draw()
  70
+  },
  71
+  
67 72
   draw: function() {
68 73
     this.context.clearRect(0, 0, this.width, this.height)
69 74
     $(".primer_text", this.element).remove()
@@ -172,6 +177,17 @@ Primer.Layer.prototype = {
172 177
     if(this.primer) this.primer.draw()
173 178
   },
174 179
   
  180
+  removeChild: function(child) {
  181
+    var newChildren = []
  182
+    for (var i = 0; i < this.children.length; i++) {
  183
+      var c = this.children[i]
  184
+      if (c != child) {
  185
+        newChildren.push(c)
  186
+      }
  187
+    }
  188
+    this.children = newChildren
  189
+  },
  190
+  
175 191
   /* events */
176 192
   
177 193
   mouseover: function(fn) {

0 notes on commit 4b338ec

Please sign in to comment.
Something went wrong with that request. Please try again.