Skip to content

Commit 8237fb2

Browse files
author
Steven G. Harms
committed
menubar: massive refactor for readability
Emergent in the menubar widget since my first patchfix (9f53e0a) is that there is significant behavioral difference between: * A menuitem that *does* have a sub-menu * A menuitem that *does not* have a sub-menu Typically, from an OO POV, the caller should be able to call `menuItem.close()` on either one of these cases and not have to bear the burden of knowing whether or not said `menuItem` has submenus in it. Ergo, "properly" speaking, I would want to create two new constructors and assign the logic there. But the, "properly" those things should be their own class, perhaps rightly a class that should be part of the JQuery UI widget set. As an intermediary measure I have tried to use a very simple procedural style (à la C) so that the code is small, comprehensible, and doesn't rely on using `$.each` iteration to apply or remove behavior to elements. I believe, by using this behavior, the code is much more digestible. It as, at the very least, for me. Beyond the coding philosophy part of the refactor, I attempted to bring standard sane behavior for "menu item without submenu." This behavior may need to be modified as, up to the point of writing, there has been no fully definition of these menuItems' standard of behavior.
1 parent 706d882 commit 8237fb2

File tree

2 files changed

+290
-161
lines changed

2 files changed

+290
-161
lines changed

tests/visual/menubar/menubar.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ <h2>Default menubar</h2>
4141
<li><a href="#Quit">Quit</a></li>
4242
</ul>
4343
</li>
44+
<li><a href="#Stubby">Stubby</a></li>
4445
<li>
4546
<a href="#Edit">Edit</a>
4647
<ul>

0 commit comments

Comments
 (0)