#319 bug
pmontrasio

Google Chrome: Uncaught TypeError: Object [object HTMLLIElement] has no method 'setStyle'

Reported by pmontrasio | September 3rd, 2008 @ 11:55 AM | in 1.6.1

The code in the attached test case fails when run by Google Chrome. It works fine in FF3 and IE6. The JS code is simple and it should hide a

element:

Element.observe(window, 'load', init);

function init(event) { $("err").setStyle({ display: 'none' }); }

The error message is

Uncaught TypeError: Object [object HTMLLIElement] has no method 'setStyle'

I tested it using prototype 1.6.0.2 and the error is at line 598. I also tested it with prototype 1.5.1.2 and the error is at line 453.

Note that both

document.getElementById('err').innerHTML = "ok";

and

$("err").innerHTML = "ok";

work fine from within the init function.

Comments and changes to this ticket

  • Juriy Zaytsev

    Juriy Zaytsev September 3rd, 2008 @ 04:41 PM

    • → Milestone changed from “” to “1.6.1”
    • → State changed from “new” to “bug”
    • → Assigned user changed from “” to “Juriy Zaytsev”

    For some reason HTMLElement.prototype is never extended by Prototype (in Chrome)

    What's interesting is that Chrome actually seems to create inheritance chain between HTMLLIElement and HTMLElement (as WebKit and Gecko do) - setting HTMLElement as a [[Prototype]] of any "specific element constructor" - HTMLLIElement, HTMLAnchorElement, HTMLDivElement, etc.:

    
    HTMLLIELement.prototype.__proto__ === HTMLElement.prototype; // true
    

    I'll take a look at the problem closer when I get a chance.

  • Juriy Zaytsev

    Juriy Zaytsev September 3rd, 2008 @ 09:50 PM

    Can't figure it out yet, or even reproduce an error, but couple of points are worth mentioning:

    
    typeof Element.prototype.setStyle; // "undefined"
    typeof HTMLElement.prototype.setStyle; // "undefined"
    typeof HTMLDivElement.prototype.setStyle; // "undefined"
    typeof document.createElement('div').setStyle; // "function"
    
  • Juriy Zaytsev

    Juriy Zaytsev September 3rd, 2008 @ 11:06 PM

    I can't find any logical explanation to what is happening. HTMLElement.prototype looses all of the methods once in a while (!) Sometimes test page opens without errors, sometimes it throws the above mentioned one.

  • Mark Caudill

    Mark Caudill September 4th, 2008 @ 01:03 AM

    Could this be a Chrome beta issue? Is this reported in their bug tracker too? I'd wager "random" means browser error because we do not manager memory.

  • Juriy Zaytsev

    Juriy Zaytsev September 4th, 2008 @ 01:50 AM

    Mark,

    I suspect it to be a "beta" issue as well. Their google group has one similar report (with no answers). I haven't checked bugtracker yet.

  • Juriy Zaytsev

    Juriy Zaytsev September 4th, 2008 @ 02:57 AM

    Facebook's library has similar problems: http://forum.developers.facebook...

    Facebook's issue is on Chrome's bug tracker (in numerous tickets actually): http://code.google.com/p/chromiu...

  • Aaron Shafovaloff

    Aaron Shafovaloff September 4th, 2008 @ 06:25 AM

    Looks like it got fixed:

    http://code.google.com/p/chromiu...

    It was a "for in" problem.

  • pmontrasio

    pmontrasio September 4th, 2008 @ 10:20 AM

    I downloaded the latest Chromium release (#1712) from build.chromium.org and they didn't fix this bug yet.

    However I confirm that it doesn't always happen. I've got two tabs open: the first one passes my test case, the second one fails.

    Sorry for having opened it to you guys instead of to Google. I'm doing it now.

  • pmontrasio

    pmontrasio September 4th, 2008 @ 10:51 AM

    I opened the bug to Google as http://code.google.com/p/chromiu... Let's see what happens.

  • Juriy Zaytsev

    Juriy Zaytsev September 4th, 2008 @ 01:46 PM

    @pmontrasio Thanks! Let's see what they say.

  • pmontrasio

    pmontrasio October 6th, 2008 @ 12:38 PM

    I just got mail from Google's bug tracking site. They say that this issue has been fixed. The details are at http://code.google.com/p/chromiu... but here are the highlights:

    The problem was that JavaScript wrappers for DOM nodes were created in the context of the inspector and not in the context of the document from which they originated.

    This has been fixed:

    http://codereview.chromium.org/6442

    I have verified that the test case of this bug report works when reloaded with the inspector open and I have verified that the functional tests distributed with the prototype library work when reloading with the inspector open.

    I have no time now to check if the latest Chromium build contains the fix, but I'll do it as soon as I can.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Prototype JavaScript library.

Shared Ticket Bins

Attachments