New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement custom element reactions #17614
Changes from 1 commit
901a202
596ed55
4665991
9b587a4
File filter...
Jump to…
Invoke backup element queue via a microtask
- Loading branch information
| @@ -29,6 +29,8 @@ use js::conversions::ToJSValConvertible; | ||
| use js::jsapi::{Construct1, IsCallable, IsConstructor, HandleValueArray, HandleObject, MutableHandleValue}; | ||
| use js::jsapi::{Heap, JS_GetProperty, JSAutoCompartment, JSContext}; | ||
| use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue}; | ||
| use microtask::Microtask; | ||
| use script_thread::ScriptThread; | ||
| use std::cell::Cell; | ||
| use std::collections::{HashMap, VecDeque}; | ||
| use std::ops::Deref; | ||
| @@ -532,13 +534,7 @@ impl CustomElementReactionStack { | ||
| self.processing_backup_element_queue.set(BackupElementQueueFlag::Processing); | ||
|
|
||
| // Step 4 | ||
| // TODO: Invoke Microtask | ||
|
|
||
| // Step 4.1 | ||
| self.backup_queue.invoke_reactions(); | ||
|
|
||
| // Step 4.2 | ||
| self.processing_backup_element_queue.set(BackupElementQueueFlag::NotProcessing); | ||
| ScriptThread::enqueue_microtask(Microtask::CustomElementReaction); | ||
| } | ||
|
|
||
| /// https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-callback-reaction | ||
| @@ -630,6 +626,7 @@ impl ElementQueue { | ||
| while let Some(element) = self.next_element() { | ||
| element.invoke_reactions() | ||
cbrewster
Author
Member
|
||
| } | ||
| self.queue.borrow_mut().clear(); | ||
|
||
| } | ||
|
|
||
| fn next_element(&self) -> Option<Root<Element>> { | ||
| @@ -0,0 +1,23 @@ | ||
| [ChildNode.html] | ||
| type: testharness | ||
| [before on ChildNode must enqueue a connected reaction] | ||
| expected: FAIL | ||
|
|
||
| [before on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document] | ||
| expected: FAIL | ||
|
|
||
| [after on ChildNode must enqueue a connected reaction] | ||
| expected: FAIL | ||
|
|
||
| [after on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document] | ||
| expected: FAIL | ||
|
|
||
| [replaceWith on ChildNode must enqueue a connected reaction] | ||
| expected: FAIL | ||
|
|
||
| [replaceWith on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document] | ||
| expected: FAIL | ||
|
|
||
| [replaceWith on ChildNode must enqueue a disconnected reaction] | ||
| expected: FAIL | ||
|
|
| @@ -0,0 +1,5 @@ | ||
| [HTMLTitleElement.html] | ||
| type: testharness | ||
| [text on HTMLTitleElement must enqueue disconnectedCallback when removing a custom element] | ||
| expected: FAIL | ||
|
|
| @@ -0,0 +1,14 @@ | ||
| [ParentNode.html] | ||
| type: testharness | ||
| [prepend on ParentNode must enqueue a connected reaction] | ||
| expected: FAIL | ||
|
|
||
| [prepend on ParentNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document] | ||
| expected: FAIL | ||
|
|
||
| [append on ParentNode must enqueue a connected reaction] | ||
| expected: FAIL | ||
|
|
||
| [append on ParentNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document] | ||
| expected: FAIL | ||
|
|
Can these reactions end up appending an element to this queue?