Maybe those browsers don't expose getters and setters as if they were
attributes. What you're coding in your new Element call is equivalent
to this:
<div innerHTML="hello"></div>
IE has lots of bugs around attributes and methods clashing. Try naming
a submit button submit some time and see how much fun you can have.
var text1 = new Element('div').update('hello'); //?
var text1 = newElement('div').innerHTML = 'hello'; //?
see if one of those does the quicker job for you.
I believe that this is the fastest of all, but it doesn't return you a
reference to the element you just created:
$('someParentElement').insert('<div>hello</div>');
Maybe you could add an ID or className to the div you create that way,
and then test for it later when you need a reference to the element.
Walter
On May 13, 2011, at 9:41 AM, jose maria Cano wrote:
Hi Guys,
I've discovered a way to create and insert an element in a faster way,
for IE the difference is huge, like a half better.
Normally I’m creating the elements in this way.
var text1 = new Element('div').insert('hello');
But I’ve seen that if you do that, is much faster:
var text1 = new Element('div', { 'innerHTML': 'hello' });
The problem is that this second way is only working for IE, not for FF
or Chrome. Do you know what’s the problem?
Thanks a lot in advanced.
Kr, Jose
--
You received this message because you are subscribed to the Google
Groups "Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
.
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.