TAILIEUCHUNG - Practical prototype and scipt.aculo.us part 53

Practical prototype and part 53: The information in this book is distributed on an "as is" basis, without warranty Although every pre-caution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. | CHAPTER 13 PROTOTYPE AS A PLATFORM 309 So we must search the browser s user-agent string to see whether it uses the affected engine then we must look at the release year of the engine to figure out whether it s old enough to be affected. Of course Prototype fixes this so that you as a developer need not worry about it. And the quirks you ll encounter probably won t be so tenacious. But eventually if you write enough code you ll need to do some occasional browser sniffing. Do it apologize to yourself and move on. If it makes you queasy good It should make you queasy. That ll stop you from using it more often than you ought to. And the fact that you re ashamed of your old poetry simply affirms the sophistication of your adult tastes. IfYou Must . So if you ve got no other options . . . yes it s OK to sniff. But you ve got to do it right. Perform the following steps or else suffer the wrath of the browser gods. Get a Second Opinion First assuage your guilt. Find a friend or coworker across the hall on Instant Messenger in IRC and summarize your dilemma. Often your consultant will suggest an approach you hadn t thought of. But if he can t think of a better way you ll feel more secure in your decision. Take Notes Write a comment that explains the problem and why you ve got to sniff. Put it as close as possible to the offending line of code. Be verbose. This is for your own benefit six months from now you won t remember why you wrote that code the way you did so think of it as a message to Future You. Walk a Straight Code Path Most importantly write code without unnecessary kinks and contortions. If Internet Explorer needs one thing but all other browsers need another write your function to handle the other browsers. If one approach uses the DOM standard and the other uses a proprietary Internet Explorer method write your function to use the DOM standard then at the beginning of the function send Internet Explorer into a different function to handle the weird case. 310 .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.