2010-07-15 2 views
2

IE는 (물론, 내 코드의 맥락에서) 압축되지 않은 raphaeljs 1.4.7에서 다음 줄 2207에 질식 할 나타납니다!무엇이 (gs.left! = (t = left + "px") && (gs.left = t);)할까요?

gs.left != (t = left + "px") && (gs.left = t); 

내가 =에 익숙 해요 이런 맥락에서 구문 그래서 나는 무슨 일이 일어나고 있는지 또는 IE가 그것에 대해 불만 스러울지를 알아내는 것이 어렵다는 것을 알고 있습니다. IE6에서 테스트했습니다. & IE8 및 Chrome & OSX에서 Firefox. 물론 FF로 문제가 발생한 경우 Firebug를 사용하여 단계를 밟을 것입니다 ...

그 라인이 무엇을 달성하려고 시도하고 있는지, 더 잘 말하면 IE에 잠재적으로 문제가있는 이유를 알 수 있습니까? 그것으로? 귀하의 상황에 대한

는 여기에 그 라인 전체 방법입니다 :

코드 줄 아무 문제 없습니다
Element[proto].setBox = function (params, cx, cy) { 
     if (this.removed) { 
      return this; 
     } 
     var gs = this.Group.style, 
      os = (this.shape && this.shape.style) || this.node.style; 
     params = params || {}; 
     for (var i in params) if (params[has](i)) { 
      this.attrs[i] = params[i]; 
     } 
     cx = cx || this._.rt.cx; 
     cy = cy || this._.rt.cy; 
     var attr = this.attrs, 
      x, 
      y, 
      w, 
      h; 
     switch (this.type) { 
      case "circle": 
       x = attr.cx - attr.r; 
       y = attr.cy - attr.r; 
       w = h = attr.r * 2; 
       break; 
      case "ellipse": 
       x = attr.cx - attr.rx; 
       y = attr.cy - attr.ry; 
       w = attr.rx * 2; 
       h = attr.ry * 2; 
       break; 
      case "image": 
       x = +attr.x; 
       y = +attr.y; 
       w = attr.width || 0; 
       h = attr.height || 0; 
       break; 
      case "text": 
       this.textpath.v = ["m", round(attr.x), ", ", round(attr.y - 2), "l", round(attr.x) + 1, ", ", round(attr.y - 2)][join](E); 
       x = attr.x - round(this.W/2); 
       y = attr.y - this.H/2; 
       w = this.W; 
       h = this.H; 
       break; 
      case "rect": 
      case "path": 
       if (!this.attrs.path) { 
        x = 0; 
        y = 0; 
        w = this.paper.width; 
        h = this.paper.height; 
       } else { 
        var dim = pathDimensions(this.attrs.path); 
        x = dim.x; 
        y = dim.y; 
        w = dim.width; 
        h = dim.height; 
       } 
       break; 
      default: 
       x = 0; 
       y = 0; 
       w = this.paper.width; 
       h = this.paper.height; 
       break; 
     } 
     cx = (cx == null) ? x + w/2 : cx; 
     cy = (cy == null) ? y + h/2 : cy; 
     var left = cx - this.paper.width/2, 
      top = cy - this.paper.height/2, t; 
     gs.left != (t = left + "px") && (gs.left = t); 
     gs.top != (t = top + "px") && (gs.top = t); 
     this.X = pathlike[has](this.type) ? -left : x; 
     this.Y = pathlike[has](this.type) ? -top : y; 
     this.W = w; 
     this.H = h; 
     if (pathlike[has](this.type)) { 
      os.left != (t = -left * zoom + "px") && (os.left = t); 
      os.top != (t = -top * zoom + "px") && (os.top = t); 
     } else if (this.type == "text") { 
      os.left != (t = -left + "px") && (os.left = t); 
      os.top != (t = -top + "px") && (os.top = t); 
     } else { 
      gs.width != (t = this.paper.width + "px") && (gs.width = t); 
      gs.height != (t = this.paper.height + "px") && (gs.height = t); 
      os.left != (t = x - left + "px") && (os.left = t); 
      os.top != (t = y - top + "px") && (os.top = t); 
      os.width != (t = w + "px") && (os.width = t); 
      os.height != (t = h + "px") && (os.height = t); 
     } 
    }; 

답변

0

-gs.leftleft이 정의 가정이. 다음과 같은 의미입니다.

t = left + 'px'; 
if (gs.left != t) gs.left = t; 

"질식"이란 정확히 무엇을 의미합니까?

+0

감사합니다. 나는이 코드 라인에 문제가 있다고 제안하지 않고, 단지 그것을 이해하기를 원했다. IE는 모호한 오류 페이지 중 하나를보고합니다 : 다른 브라우저가 계속 수행하는 동안이 행에 잘못된 인수가 있습니다. – Andrew

+0

알았어. IE에서 "gs"는 호출 스택 위로 "left"속성을 가진 객체로 정의되지 않습니다. "gs", "gs.left"및 "left"에 경고하여 시작하여 치명적인 라인이 무엇을 가지고 있는지 확인하십시오. – oldestlivingboy