mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 16:58:58 +00:00
LibWeb: Implement DataTransferItemList.clear()
This commit is contained in:
parent
0c1532626f
commit
3fc7613bf1
Notes:
github-actions[bot]
2025-09-12 10:31:38 +00:00
Author: https://github.com/tcl3
Commit: 3fc7613bf1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6088
Reviewed-by: https://github.com/gmta
3 changed files with 11 additions and 1 deletions
|
@ -125,6 +125,15 @@ WebIDL::ExceptionOr<void> DataTransferItemList::remove(WebIDL::UnsignedLong inde
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitemlist-clear
|
||||
void DataTransferItemList::clear()
|
||||
{
|
||||
// The clear() method, if the DataTransferItemList object is in the read/write mode, must remove all the items from
|
||||
// the drag data store. Otherwise, it must do nothing.
|
||||
if (m_data_transfer->mode() == DragDataStore::Mode::ReadWrite)
|
||||
m_data_transfer->clear_data();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitemlist-item
|
||||
Optional<JS::Value> DataTransferItemList::item_value(size_t index) const
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
WebIDL::ExceptionOr<GC::Ptr<DataTransferItem>> add(String const& data, String const& type);
|
||||
GC::Ptr<DataTransferItem> add(GC::Ref<FileAPI::File>);
|
||||
WebIDL::ExceptionOr<void> remove(WebIDL::UnsignedLong index);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
DataTransferItemList(JS::Realm&, GC::Ref<DataTransfer>);
|
||||
|
|
|
@ -9,5 +9,5 @@ interface DataTransferItemList {
|
|||
DataTransferItem? add(DOMString data, DOMString type);
|
||||
DataTransferItem? add(File data);
|
||||
undefined remove(unsigned long index);
|
||||
[FIXME] undefined clear();
|
||||
undefined clear();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue