TAILIEUCHUNG - jQuery in Action phần 8

Tham khảo tài liệu 'jquery in action phần 8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | objects and collections 177 A pattern for mimicking inheritance in JavaScript is to extend an object by copying the properties of a base object into the new object extending the new object with the capabilities of the base. NOTE If you re an aficionado of object-oriented JavaScript you ll no doubt be familiar with extending not only object instances but also their blueprints via the prototype property of object constructors. .extend can be used to effect such constructor-based inheritance by extending prototype as well as object-based inheritance by extending existing object instances. Because understanding such advanced topics isn t a requirement in order to use jQuery effectively this is a subject albeit an important one that s beyond the scope of this book. It s fairly easy to write JavaScript code to perform this extension by copy but as with so many other procedures jQuery anticipates this need and provides a ready-made utility function to help us out. As we ll see in the next chapter this function is useful for much more than extending an object but even so its name is .extend . Its syntax is as follows Function syntax .extend .extend target source1 source2 . sourceN Extends the object passed as target with the properties of the remaining passed objects. Parameters target Object The object whose properties are augmented with the properties of the source objects. This object is directly modified with the new properties before being returned as the value of the function. Any properties with the same name as properties in any of the source elements are overridden with the values from the source elements. sourcel . sourceN Object One or more objects whose properties are added to the target object. When more than one source is provided and properties with the same name exist in the sources sources later in the argument list take precedence over those earlier in the list. Returns The extended target object. 178 CHAPTER 6 jQuery utility .

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.