#558 bug
garrett

IE crash on element.setStyle

Reported by garrett | February 19th, 2009 @ 11:37 AM

My Internet Explorer 6 crashed when element.setStyle was called by the scriptaculous SlideDown effect. The crash was caused by this line:


elementStyle[(property == 'float' || property == 'cssFloat') ?
            (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
              property] = styles[property];

I made following if statement around it:


if (styles[property] != null && styles[property] != '') {

which helped me out.

The interesting thing was when I added an alert above the problem line the crash didn't occur. I reckon this is some sort of race condition failure.

Comments and changes to this ticket

  • Juriy Zaytsev

    Juriy Zaytsev February 19th, 2009 @ 04:44 PM

    So was styles[property] null or an empty string? And which property was setStyle called with?

  • Andrew Dupont

    Andrew Dupont February 22nd, 2009 @ 06:02 AM

    • Tag set to needs_failing_test_case

    Can you make a test page, please?

  • garrett

    garrett February 23rd, 2009 @ 10:33 AM

    Well setStyle is called several times, this is the output when I print the variables property and styles[property] in the for loop:

    "height 0px" "height 9px" "bottom 267px" "height 43px" "bottom 233px" "height 63px" "bottom 213px" "height 87px" "bottom 189px" "height 126px" "bottom 150px" "height 152px" "bottom 124px" "height 204px" "bottom 72px" "height 236px" "bottom 40px" "height 260px" "bottom 16px" "height 273px" "bottom 3px" "height 276px" "bottom 0px" "top " "left " "width " "height " "fontSize " "bottom null"

    I'm gonna make a test case later.

  • Tobie Langel

    Tobie Langel February 24th, 2009 @ 08:55 AM

    • State changed from “new” to “bug”

    Looks like there are two issues at hand:

    1. Element#setStyle should not crash IE if passed null (maybe we should coerce values to string ?)
    2. scripty is possibly doing parts of the math wrong.
  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 03:40 AM

    • Tag changed from needs_failing_test_case to needs:failing_testcase

    [not-tagged:"needs_failing_test_case" tagged:"needs:failing_testcase" bulk edit command]

  • Yaffle

    Yaffle August 8th, 2009 @ 12:20 PM

    Null is invalid value for some properties (bottom,left,top,right,...)
    Opera has bug, when settign this properties to null.

  • butz

    butz September 8th, 2009 @ 11:55 AM

    We have here the same problem with IE 8 and setStyle() ... is this problem fixed within the actual release 1.6.1 or shall we use the "workaround" above from garrett ("if (styles[property] != null && styles[property] != '') {")?

    Thank your for your answer!

    Greetings

  • T.J. Crowder

    T.J. Crowder November 16th, 2009 @ 04:50 PM

    [responsible:none bulk edit command]

  • Tisho Georgiev

    Tisho Georgiev March 1st, 2010 @ 09:07 PM

    • Tag changed from needs:failing_testcase to needs:failing_testcase, section:dom
  • William

    William May 25th, 2010 @ 08:11 PM

    Adding that if statement did not fix the issue for me, however adding

    if (elementStyle.styleFloat){

    around it fixed the issue which leads me to believe there is something funky going on with your Object.isUndefined method

  • Victor

    Victor May 28th, 2010 @ 09:14 AM

    Effect.SlideDown is causing errors in IE and Opera because it remembers bottom value

    var oldInnerBottom = element.down().getStyle('bottom');
    

    and restores value after finish

    afterFinishInternal: function(effect) {
      effect.element.undoClipping().undoPositioned();
      effect.element.down().undoPositioned().setStyle({
        bottom: oldInnerBottom
      });
    }
    

    Sometimes Opera returns "NaNpx" for bottom value, and sometimes IE returns null. IMHO this should be checked/fixed internally in Effect.SlideUp, not in Prototype because Prototype developers cannot insert such checks for all impossible argument values in all methods.

  • PatMartinez

    PatMartinez October 3rd, 2018 @ 06:57 PM

    Dyslexia is really a big challenge and I have read many people same reviews on review of customessaywriter.co.uk about this problem.I really liked your post.It really helped us.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

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

Referenced by

Pages