CharacterBoundsUpdateEvent: thuộc tính rangeStart
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Thuộc tính chỉ đọc CharacterBoundsUpdateEvent.rangeStart biểu diễn độ lệch của ký tự đầu tiên trong vùng văn bản có thể chỉnh sửa mà hệ điều hành cần biết ranh giới.
Giá trị
Một Number.
Ví dụ
>Đọc giá trị rangeStart
Ví dụ này minh họa cách sử dụng sự kiện characterboundsupdate và đọc giá trị của các thuộc tính rangeStart và rangeEnd.
js
const editContext = new EditContext();
editorElement.editContext = editContext;
editContext.addEventListener("characterboundsupdate", (e) => {
console.log(
`The OS needs the bounds of the chars at ${e.rangeStart} - ${e.rangeEnd}.`,
);
});
Thông số kỹ thuật
| Specification |
|---|
| EditContext API> # dom-characterboundsupdateevent-rangestart> |