Problems with Chrome

已查看 115 次
跳至第一个未读帖子

Posseidon

未读,
2008年9月19日 12:40:382008/9/19
收件人 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

未读,
2008年9月19日 12:44:422008/9/19
收件人 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

未读,
2008年9月22日 13:16:592008/9/22
收件人 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

未读,
2008年9月22日 14:57:132008/9/22
收件人 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

未读,
2008年9月22日 15:29:572008/9/22
收件人 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__

未读,
2008年10月14日 04:32:452008/10/14
收件人 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

未读,
2008年10月14日 11:50:312008/10/14
收件人 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
回复全部
回复作者
转发
0 个新帖子