[de-xbl] convert agenda list bindings to custom elements
Categories
(Calendar :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: pmorris, Assigned: pmorris)
References
Details
Attachments
(1 file, 3 obsolete files)
|
71.92 KB,
patch
|
Details | Diff | Splinter Review |
Convert the four agenda list bindings to custom elements:
https://dxr.mozilla.org/comm-central/source/comm/calendar/base/content/agenda-listbox.xml
| Assignee | ||
Comment 1•7 years ago
|
||
Ready for review. Tested by checking that the events list in the today-pane worked as expected:
- "today" etc. headings toggle correctly
- event selection works (thanks to
inheritedAttributesandinitializeAttributeInheritance) - double clicking an event (regular or all day) opens the event for editing (but didn't open a second "create new event" dialog)
- double clicking outside of an event but inside the today pane opens a "create new event" dialog
- right click on event and check that context menu items worked
Comment 2•7 years ago
|
||
| Assignee | ||
Comment 3•7 years ago
|
||
Now un-bit-rotted.
- if (this.hasChildNodes())
Good call. I've added these checks. Not sure how to test moving the element in the DOM. Dragging appears to be broken, unrelated to this patch:
JavaScript error: chrome://calendar/content/calendar-dnd-listener.js, line 603: NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 1 [nsIDragService.invokeDragSession]
I tried changing the date of an event, and it was moved to a different day in the todaypane (but I'm not sure if this moves or recreates the element).
- if (this.delayConnectedCallback())
I've removed these checks. The converter puts them in, but reading the code for delayConnectedCallback, it is intended as an opt-in feature, for when it is needed, and I don't see a reason to use it here. Seems to me it adds complexity without real benefit in most cases, aside from those where it's really needed.
- event listeners
I looked into whether event listeners should be added in the constructor or in connectedCallback. What I read argued that the constructor is the preferred place. 1. connectedCallback can be called several times, like when an element is moved, and there's no point in re-adding them each time. 2. events that you want to catch might happen after construction but before the element is connected. 3. there could be confusion if you add them in connectedCallback and then think you need to remove them in disconnectedCallback, which is not the case. (Although, listeners added outside the element, say to window, would need to be removed in disconnectedCallback.)
"In general, the constructor should be used to set up initial state and default values, and to set up event listeners and possibly a shadow root."
https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-conformance
They are added in constructors in these docs:
https://developers.google.com/web/fundamentals/web-components/customelements
"Best practices for adding event listeners to a host element"
"A custom element can add an event listener to itself or its own children from its constructor without any issues"
https://github.com/Polymer/lit-element/issues/139
| Assignee | ||
Comment 4•7 years ago
|
||
if (this.delayConnectedCallback()) {
return;
}
I've added these back in after reading bug 1495946 comment 22.
| Assignee | ||
Comment 5•7 years ago
|
||
And... updated so it works for current builds.
Comment 6•7 years ago
|
||
Hmm, there's a collision with bug 1531305 unfortunately. Mea clupa. Too many ongoing conversions... :(
Comment 7•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 9•7 years ago
|
||
Marking as a duplicate of bug 1531305 since that's where work is being done for this.
Description
•