Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add 'item-menu-' prefix #5

Merged
merged 2 commits into from

3 participants

Damián Suárez Julian Gruber TJ Holowaychuk
Damián Suárez
Owner

Add 'item-menu-' prefix to each classname of the menu item

TJ Holowaychuk tj merged commit b2020d6 into from
Julian Gruber

why that?

Owner

It just is a convention used in almost all components. Nothing important.

Owner

oprah-query!

lulz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 8 deletions.
  1. +8 −8 index.js
16 index.js
View
@@ -4,7 +4,7 @@
*/
var Emitter = require('emitter')
- , $ = require('jquery');
+ , o = require('jquery');
/**
* Expose `Menu`.
@@ -30,12 +30,12 @@ function Menu() {
if (!(this instanceof Menu)) return new Menu;
Emitter.call(this);
this.items = {};
- this.el = $('<ul class=menu>').hide().appendTo('body');
+ this.el = o('<ul class=menu>').hide().appendTo('body');
this.el.hover(this.deselect.bind(this));
- $('html').click(this.hide.bind(this));
+ o('html').click(this.hide.bind(this));
this.on('show', this.bindKeyboardEvents.bind(this));
this.on('hide', this.unbindKeyboardEvents.bind(this));
-};
+}
/**
* Inherit from `Emitter.prototype`.
@@ -60,7 +60,7 @@ Menu.prototype.deselect = function(){
*/
Menu.prototype.bindKeyboardEvents = function(){
- $(document).bind('keydown.menu', this.onkeydown.bind(this));
+ o(document).bind('keydown.menu', this.onkeydown.bind(this));
return this;
};
@@ -71,7 +71,7 @@ Menu.prototype.bindKeyboardEvents = function(){
*/
Menu.prototype.unbindKeyboardEvents = function(){
- $(document).unbind('keydown.menu');
+ o(document).unbind('keydown.menu');
return this;
};
@@ -148,8 +148,8 @@ Menu.prototype.add = function(text, fn){
}
var self = this
- , el = $('<li><a href="#">' + text + '</a></li>')
- .addClass(slug)
+ , el = o('<li><a href="#">' + text + '</a></li>')
+ .addClass('menu-item-', slug)
.appendTo(this.el)
.click(function(e){
e.preventDefault();
Something went wrong with that request. Please try again.