DataTransfer: phương thức addElement()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

Phương thức DataTransfer.addElement() đặt nguồn kéo thành phần tử đã cho. Phần tử này sẽ là phần tử mà các sự kiện dragdragend được kích hoạt, chứ không phải đích mặc định (nút đã được kéo).

Note: Phương thức này dành riêng cho Firefox.

Cú pháp

js
addElement(element)

Tham số

element

Element cần đặt làm nguồn kéo.

Giá trị trả về

Không có (undefined).

Ví dụ

Ví dụ này cho thấy cách sử dụng phương thức addElement().

js
function changeDragNode(event, node) {
  const dt = event.dataTransfer;
  dt.addElement(node);
}

Thông số kỹ thuật

Phương thức này không được định nghĩa trong bất kỳ tiêu chuẩn Web nào.