Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implement removeChild()

  • Loading branch information...
commit 4b338ec325d13cb30476559a5258895373219b6d 1 parent fd6022c
@mojombo authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 primer.js
View
16 primer.js
@@ -64,6 +64,11 @@ Primer.prototype = {
this.draw()
},
+ removeChild: function(child) {
+ this.root.removeChild(child)
+ this.draw()
+ },
+
draw: function() {
this.context.clearRect(0, 0, this.width, this.height)
$(".primer_text", this.element).remove()
@@ -172,6 +177,17 @@ Primer.Layer.prototype = {
if(this.primer) this.primer.draw()
},
+ removeChild: function(child) {
+ var newChildren = []
+ for (var i = 0; i < this.children.length; i++) {
+ var c = this.children[i]
+ if (c != child) {
+ newChildren.push(c)
+ }
+ }
+ this.children = newChildren
+ },
+
/* events */
mouseover: function(fn) {
Please sign in to comment.
Something went wrong with that request. Please try again.