Problems with Chrome

115 views
Skip to first unread message

Posseidon

unread,
Sep 19, 2008, 12:40:38 PM9/19/08
to Prototype & script.aculo.us
Hi guys!

i have made a little class to create textboxes!
here is the code:

var loadingWindow = Class.create();
loadingWindow.prototype = {
initialize: function()
{
this.disableDiv = new Element('div',
{ id:'disableDiv' });
this.disableDiv.insert( {top: new
Element('img', { id:'loadingGif', src:'pics/site/loading.gif',
style:'position:absolute; z-index:11; border:0px;' } ) });

this.disableDiv.addClassName('blankdiv');
},
createLoadingWindow: function( elementID )
{
var elHeight = $
( elementID ).getHeight();
if( !$('disableDiv') )
{
pageHuelle = $
( elementID ).insert( { top: this.disableDiv } );
$
('disableDiv').setStyle( { height:elHeight + 'px' } );
$
('disableDiv').down('img').setStyle( { top:elHeight*0.3 + 'px' } );
}
},
disableLoadingWindow: function()
{
if( $('disableDiv') ) $
('disableDiv').remove();
}
};

yes i know it is not pretty JS Code but it works fine in all browsers
except Chrome!
Chrome allways says the following error Message when starting my site:

Uncaught TypeError: Object [object HTMLDivElement] has no method
'insert' on line 12

its the line with this code: this.disableDiv.insert( {top: new
Element('img', { id:'loadingGif',..... and so on...

What is the problem on this? it seems that Chrome doesnot extend new
Elements!
How can i fix this?

Thank you

Greetz

Possal

Posseidon

unread,
Sep 19, 2008, 12:44:42 PM9/19/08
to Prototype & script.aculo.us
i did not change anything but now it works!
Could it be that crome has problems in loading the js files?

What happens if the Prototype.js file is not finished with loading and
this code is starting?

Greetz

kangax

unread,
Sep 22, 2008, 1:16:59 PM9/22/08
to Prototype & script.aculo.us
On Sep 19, 12:44 pm, Posseidon <possei...@aon.at> wrote:
> i did not change anything but now it works!
> Could it be that crome has problems in loading the js files?
>
> What happens if the Prototype.js file is not finished with loading and
> this code is starting?

Few people actually noticed that Chrome produces errors in a random
order.

--
kangax

Ryan Gahl

unread,
Sep 22, 2008, 2:57:13 PM9/22/08
to prototype-s...@googlegroups.com
Not that this is useful, but IMHO you should just ignore Chrome. Not enough people will be using it for it to matter much, and it's just plain buggy.
--
Ryan Gahl
Manager, Senior Software Engineer
Nth Penguin, LLC
http://www.nthpenguin.com
--
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-920-574-2218
Blog: http://www.someElement.com
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

Walter Lee Davis

unread,
Sep 22, 2008, 3:29:57 PM9/22/08
to prototype-s...@googlegroups.com
Agree, if by this you mean "ignore it now". It will become something
to bargain with soon enough, but it's still very much an a developer
toy for now.

Walter

__proto__.__proto__

unread,
Oct 14, 2008, 4:32:45 AM10/14/08
to Prototype & script.aculo.us
I think the problem comes from :

Element.extend = (function() {
if (Prototype.BrowserFeatures.SpecificElementExtensions)
return Prototype.K;
...
}

"Runtime created" elements do not behave as "HTML source" elements, in
Chrome...
It looks like they do not share the same prototype !
It seems that the $ function do not try to extend elements in chrome,
because it assumes that element are "prototype extended".

If you really need Chrome support, you can do :

theElement = $('...');
if (! theElement.insert) { // if the $ function did not work well, as
in Chrome...
theElement.insert = function (insertions) {
return Element.insert(this, insertions)
}.bind(theElement );
}
theElement.insert(...);






kangax

unread,
Oct 14, 2008, 11:50:31 AM10/14/08
to Prototype & script.aculo.us
On Oct 14, 4:32 am, "__proto__.__proto__" <guillaume.cr...@gmail.com>
wrote:
It would be nuts to create a standalone function for every element out
there (performance and memory wise) : )
Don't you think?

--
kangax
Reply all
Reply to author
Forward
0 new messages