웹개발하는데 개빡치네

사파리 가끔씩 존나 이상한 버그 튀어나오는데 몇시간 검색해서 원인 찾으면 10년 넘은 사파리 버그임 ㅅㅂ

이 무능한 새끼들 대체 왜 안고치는거냐??


버그 1. 사파리 repaint 버그

js로 style 수정하다보면 특정 상황에서 갑자기 repaint를 안하기 시작함. 상세 조건은 불명


해결

sel.style.display='none';
sel.offsetHeight; // no need to store this anywhere, the reference is enough
sel.style.display='';

https://stackoverflow.com/questions/8927478/jquery-css-rendering-works-in-firefox-not-in-chrome


repaint 거부하는 element에다가 offsetHeight 한번 참조해주면 됨. 병신임.


버그 2. 사파리 touch event 씹는 버그

absolute, fixed 같은 element은 처음 생성되고 body를 스크롤 한 직후에는 이벤트 씹음. 반드시 어딘가를 터치해준 다음에 이벤트 먹음


해결

document.getElementsByTagName("body")[0].addEventListener("touchstart",function(){});

https://stackoverflow.com/questions/8809706/ios-5-safari-bug-with-html-touch-events-on-positionfixed-div


body에다가 아무것도 안하는 터치이벤트 먹여주면 해결됨


뭐 이딴 브라우저가 다 있냐 옛날에 ie6 가지고 놀 때도 이런 버그는 안생겼었는데 개같은거