2012-09-19 2 views
4

크롬, FF, 사파리, IE9에 있지만, IE8에서 실행이 코드에이 속성 또는 메서드를 지원하지 않습니다 : 나는 다른 사람과 유사한 사례를 발견하지만 난 왜 발생 모르고이 문제를 해결할 수있는 방법을개체 난이 오류가 유일한 IE8

return [ 
    { 
     title:'Edit', 
     customClass:'actionEdit', 
     action:{ 
      type:'getLink', 
      url:'/admin/products/edit/'+data.id()+'' 
     } 
    }, 
    { 
     title:'Attaches', 
     customClass:'actionAttaches', 
     action:{ 
      type:'getLink', 
      url:'/admin/attaches/index/product/'+data.id()+'' 
     } 
    }, 
    { 
     title:'Delete', 
     customClass:'actionDelete', 
     action:{ 
      type:'postLink', 
      url:'/admin/products/delete/'+data.id()+'', 
      confirm:'Are you sure you want to delete %s?', 
      arg:$('#ProductAdminIndexList #'+data.id()+' .productId').text().trim() 
     } 
    } 
]; 

(라인 80에 "복귀 ["하지만, 개발자 도구의 디버거는 아래의 모든 코드를 강조).

+1

IE8은 'trim'과 같은 일부 (표준이 아닌 일반적인) 자바 스크립트 메소드를 지원하지 않습니다. 여기를 참조하십시오 : http://stackoverflow.com/a/2308157/1001985 – McGarnagle

답변

8

이렇게 해결하십시오.

arg: $.trim($('#ProductAdminIndexList #'+data.id()+' .productId').text()) 
+1

왜 downvote? 우리는 이미 jQuery가 사용되고 있다는 것을 알고 있으므로, 왜 trim 함수를 사용하지 않을까요? – lbstr

2

저는 거의 긍정적입니다. IE8에는 trim() 메서드가 없습니다. 그러나 jQuery가 provides an implementation 인 경우 이미 jQuery를 사용하고있는 것 같아서 $.trim()이라고 부릅니다.