From 3d13c37a933e0af3c0cd8c4437e9d587c0331854 Mon Sep 17 00:00:00 2001 From: Dan Newcome Date: Thu, 12 Apr 2012 18:03:47 -0700 Subject: [PATCH] adding suppport for parent() to api --- donatello.js | 4 ++++ rect.js | 2 ++ tests/api.html | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 tests/api.html diff --git a/donatello.js b/donatello.js index 633d3fe..93e5a8e 100644 --- a/donatello.js +++ b/donatello.js @@ -209,6 +209,10 @@ Donatello.prototype.node = function() { return this.dom; } +Donatello.prototype.parent = function() { + return this._parent; +} + /** * Setting attributes looks for mapped attributes first, then * passes attribute through as a CSS attribute. diff --git a/rect.js b/rect.js index 411a2b9..c84e714 100644 --- a/rect.js +++ b/rect.js @@ -22,6 +22,7 @@ Donatello.Pgram = function( parent, x, y, dx, dy, skew, a ) { 'fill': f }; parent.dom.appendChild( el ); + this._parent = parent; this.dom = el; this.attr( a ); } @@ -36,6 +37,7 @@ Donatello.Pgram.prototype.draw = function() { el.style.borderWidth = this.properties['stroke-width'] + 'px'; if( skew != null ) { + console.log( 'setting skew ' + skew ); el.style[ Donatello.getTransform() ] += 'skew(' + skew + 'deg)'; } diff --git a/tests/api.html b/tests/api.html new file mode 100644 index 0000000..dbe2555 --- /dev/null +++ b/tests/api.html @@ -0,0 +1,42 @@ + + + + + + + + + + + +
+
+ +