forked from kupriyanenko/jbone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e6bcb4
commit c82df2a
Showing
9 changed files
with
385 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
node_modules/ | ||
bower_components/ | ||
perf/ | ||
|
||
*.sublime-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
addSuite({ | ||
name: 'Set attribute', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.attr('name', 'value'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.attr('name', 'value'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Get attribute', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>', { | ||
name: 'value' | ||
}); | ||
suite.jqEl = jQuery('<span>', { | ||
name: 'value' | ||
}); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.attr('name'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.attr('name'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Set value', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<input>'); | ||
suite.jqEl = jQuery('<input>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.val('name', 'value'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.val('name', 'value'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Get value', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<input>').val('name', 'value'); | ||
suite.jqEl = jQuery('<input>').val('name', 'value'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.val('name'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.val('name'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Set css', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.css('color', 'red'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.css('color', 'red'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Get css', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>').css('color', 'red').appendTo('#suite'); | ||
suite.jqEl = jQuery('<span>').css('color', 'red').appendTo('#suite'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.css('color'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.css('color'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Set normal data', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.data('key', 'value'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.data('key', 'value'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Set object data', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.data('key', {}); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.data('key', {}); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Get normal data', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>').data('key', 'value'); | ||
suite.jqEl = jQuery('<span>').data('key', 'value'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.data('key'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.data('key'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Get object data', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>').data('key', {}); | ||
suite.jqEl = jQuery('<span>').data('key', {}); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.data('key'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.data('key'); | ||
}] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
addSuite({ | ||
name: 'Backbone View', | ||
setup: function(suite) { | ||
var el = document.getElementById('suite'); | ||
|
||
suite.jbView = jbBackbone.View.extend({ | ||
events: { click: function() {} } | ||
}); | ||
|
||
suite.jqView = jqBackbone.View.extend({ | ||
events: { click: function() {} } | ||
}); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
(new suite.jbView()).remove(); | ||
}], | ||
['jQuery', function(suite) { | ||
(new suite.jqView()).remove(); | ||
}] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
addSuite({ | ||
name: 'Init' | ||
}, [ | ||
['jBone', function() { | ||
jBone(); | ||
}], | ||
['jQuery', function() { | ||
jQuery(); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Wrap DOM Node' | ||
}, [ | ||
['jBone', function() { | ||
jBone(document.createElement('div')); | ||
}], | ||
['jQuery', function() { | ||
jQuery(document.createElement('div')); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Create single Node' | ||
}, [ | ||
['jBone', function() { | ||
jBone('<span>'); | ||
}], | ||
['jQuery', function() { | ||
jQuery('<span>'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Create multiple Nodes' | ||
}, [ | ||
['jBone', function() { | ||
jBone('<p><span></span><span></span></p>'); | ||
}], | ||
['jQuery', function() { | ||
jQuery('<p><span></span><span></span></p>'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Create Node and define attributes' | ||
}, [ | ||
['jBone', function() { | ||
jBone('<span>', { | ||
'class': 'test', | ||
'name': 'value' | ||
}); | ||
}], | ||
['jQuery', function() { | ||
jQuery('<span>', { | ||
'class': 'test', | ||
'name': 'value' | ||
}); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'Search by selector' | ||
}, [ | ||
['jBone', function(suite) { | ||
jBone('div'); | ||
}], | ||
['jQuery', function(suite) { | ||
jQuery('div'); | ||
}] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
addSuite({ | ||
name: 'on/off events', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.on('click', function() {}).off(); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.on('click', function() {}).off(); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'off with eventType', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.on('click', function() {}).off('click'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.on('click', function() {}).off('click'); | ||
}] | ||
]); | ||
|
||
addSuite({ | ||
name: 'off with namespace', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.on('click.space', function() {}).off('.space'); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.on('click.space', function() {}).off('.space'); | ||
}] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
addSuite({ | ||
name: 'Remove Element', | ||
setup: function(suite) { | ||
suite.jbEl = jBone('<span>'); | ||
suite.jqEl = jQuery('<span>'); | ||
} | ||
}, [ | ||
['jBone', function(suite) { | ||
suite.jbEl.remove(); | ||
}], | ||
['jQuery', function(suite) { | ||
suite.jqEl.remove(); | ||
}] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Performance</title> | ||
<script src="../dist/jbone.js"></script> | ||
<script src="../bower_components/lodash/dist/lodash.js"></script> | ||
<script src="../bower_components/platform/platform.js"></script> | ||
<script src="../bower_components/benchmark/benchmark.js"></script> | ||
|
||
<script src="https://code.jquery.com/jquery-2.1.0.js"></script> | ||
<script src="https://rawgit.com/jashkenas/backbone/master/backbone.js"></script> | ||
<script src="https://rawgit.com/jashkenas/backbone/master/backbone.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
var jbBackbone = Backbone.noConflict(); | ||
jbBackbone.$ = jBone; | ||
|
||
var jqBackbone = Backbone.noConflict(); | ||
jqBackbone.$ = jQuery; | ||
</script> | ||
|
||
<div id="suite"></div> | ||
|
||
<script src="suite.js"></script> | ||
|
||
<script src="core.js"></script> | ||
<script src="attributes.js"></script> | ||
<script src="events.js"></script> | ||
<script src="manipulation.js"></script> | ||
<script src="backbone.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.