Results for “Object behavior & collections”
Small, practical examples. Search by task or narrow things down below.
Restore a form’s original default values
jQuery: Call the native reset method through the underlying form element.
jQuery✓ Tested
Restore the previous document title
Restore the previous document title with a small React component and explicit browser behavior.
React✓ Tested
Return a small immutable named record
Python: Use NamedTuple when callers need both tuple behavior and named fields.
Python✓ Tested
Return a value from a dialog form
HTML: A form with method dialog closes its containing dialog without a network submission.
HTML✓ Tested
Return to the previous collection in a chain
jQuery: end restores the selection before the last traversal operation.
jQuery✓ Tested
Reuse controlled-input bindings
Reuse controlled-input bindings with a small React component and explicit browser behavior.
React✓ Tested
Reuse document-title synchronization
Reuse document-title synchronization with a small React component and explicit browser behavior.
React✓ Tested
Reuse event subscription cleanup
Reuse event subscription cleanup with a small React component and explicit browser behavior.
React✓ Tested
Reveal a collapsed panel with a slide
jQuery: slideDown animates the panel’s vertical dimensions.
jQuery✓ Tested
Round a decimal using an explicit midpoint rule
C#: Use decimal literals for decimal arithmetic and choose the midpoint rounding behavior.
C#✓ Tested
Run cleanup after an AJAX failure
jQuery: always runs on success or failure and can clear loading state.
jQuery✓ Tested
Run cleanup through a scoped destructor
C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.
C++✓ Tested