Skip to content

IE8 issue ' null' is null or not an object #156

@greglbd

Description

@greglbd

Hi,

I'm having an issue with IE8 and 9 and getting the following error

'null' is null or not an object
Jquery.knob.js
Line: 716
Char: 13

Using Jquery version 1.9.0 (error persists with 1.7.0 and 1.8.0)

code

<head>

    <style>
        body{
          padding: 0;
          margin: 0px 50px;
          font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
          font-weight: 300;
          text-rendering: optimizelegibility;
        }
        p{font-size: 30px; line-height: 30px}
        div.demo{text-align: center; width: 280px; float: left}
        div.demo > p{font-size: 20px}
    </style>
</head>
<body>

    <div class="demo">
        <p>&#215; Angle offset and arc</p>
        <input class="knob loader" data-readonly="true" data-linecap="round" data-angleOffset=-125 data-angleArc=250 data-fgColor="#66EE66" value="0">
    </div>

    <div style="clear:both"></div>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script src="js/jquery.knob.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $(".demo").click(function(){
              changeColor($(".knob"), '#fff333');
            });
            $(".knob").knob({
                change : function (value) {

                    //console.log("change : " + value);
                },
                cancel : function () {
                    //console.log("cancel : ", this);
                },
                draw : function () {

                    // "tron" case
                    if(this.$.data('skin') == 'tron') {

                        var a = this.angle(this.cv)  // Angle
                            , sa = this.startAngle          // Previous start angle
                            , sat = this.startAngle         // Start angle
                            , ea                            // Previous end angle
                            , eat = sat + a                 // End angle
                            , r = 1;

                        this.g.lineWidth = this.lineWidth;

                        this.o.cursor
                            && (sat = eat - 0.3)
                            && (eat = eat + 0.3);

                        if (this.o.displayPrevious) {
                            ea = this.startAngle + this.angle(this.v);
                            this.o.cursor
                                && (sa = ea - 0.3)
                                && (ea = ea + 0.3);
                            this.g.beginPath();
                            this.g.strokeStyle = this.pColor;
                            this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sa, ea, false);
                            this.g.stroke();
                        }

                        this.g.beginPath();
                        this.g.strokeStyle = r ? this.o.fgColor : this.fgColor ;
                        this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sat, eat, false);
                        this.g.stroke();

                        this.g.lineWidth = 2;
                        this.g.beginPath();
                        this.g.strokeStyle = this.o.fgColor;
                        this.g.arc( this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
                        this.g.stroke();

                        return false;
                    }
                }
            });
            function grow($object, value){
              if($object.val() < value)
              {
                setTimeout(function(){$object.val(parseFloat($object.val())+1).trigger("change");grow($object, value);},30);
              }

            }

            function changeColor($object, value){
              $object.trigger('configure', {"fgColor":value, "inputColor": value});
            }
            grow($('.knob'), 75)
    });
    </script>
</body>

thanks in advance for any assistance.

Greg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions