mootools/mootools-core — Issue #2326: IE7/8 fails when setPosition of empty element
Author: javierarias
Created: 2012-03-09 10:24:48+00:00
State: open

IE7 and IE8 throws TypeError when you create an empty element (that is, no inner text, html or child nodes) and you try to set its position with setPosition() before injecting it in the DOM. However, it's OK if you inject an element with inner text = ''.

Error message is:

```javascript
// throws "Unable to get value of the property 'toInt': object is null or undefined”
new Element('p').setPosition({x: 10, y: 20});
// OK
new Element('p', {text: ''}).setPosition({x: 10, y: 20});
// OK
new Element('p').inject(document.body).setPosition({x: 10, y: 20});
// OK
new Element('p').grab(new Element('span')).setPosition({x: 10, y: 20});
```

http://jsfiddle.net/qWAHd/4/