views:

247

answers:

1

Hi, I'm trying to set the webkitTransform style attribute, but it's not setting for some reason. But there are other attributes that are successfully being set to the div.

This doesn't work:

var cell = document.createElement("div");
var canvas = document.createElement("img");

cell.className = "baz";
cell.appendChild(canvas);

cell.style.color = "bar";

cell.style.webkitTransform = "foo"; 

alert(cell.style.webkitTransform);  //doesn't work - returns empty  
alert(cell.style.color);            //doesn't work - returns empty
alert(cell.className);              //outputs "baz" -- works as expected

This is all nested inside a somewhat complex set of functions, where the consequences of scope aren't totally clear to me, but that doesn't seem to me to have anything to do with this...

thanks.

A: 

Try putting an actual transform on the div? Like cell.style.webkitTransform = "rotate(45deg)";

ExitToShell
that code is just the test for when I try to set it to a real attribute... and it doesnt work.but since you're really just setting the text value of these attributes, it shouldnt matter what the values are, right?
awongh
spoke too soon. I had a malformed style attribute. once I put in a valid one it worked.
awongh