Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

noConflict #40

Merged
merged 2 commits into from

3 participants

@rvagg
Collaborator

obviously nobody uses noConflict because it doesn't work.

@fat fat merged commit 5c8e15f into from
@ded
Collaborator

lulz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 25, 2011
  1. @rvagg

    make noConflict work

    rvagg authored
  2. @rvagg
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 2 deletions.
  1. +3 −1 src/bean.js
  2. +7 −1 tests/index.html
  3. +8 −0 tests/tests.js
View
4 src/bean.js
@@ -3,7 +3,9 @@
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition);
else this[name] = definition();
}('bean', function () {
- var win = window,
+ var context = this,
+ old = this.bean,
+ win = window,
__uid = 1,
registry = {},
collected = {},
View
8 tests/index.html
@@ -10,6 +10,12 @@
<script src="../support/syn/browsers.js"></script>
<script src="../support/syn/key.js"></script>
<script src="../support/qwery/qwery.js"></script>
+ <script type="text/javascript">
+ // test for noConflict()
+ function bean() {
+ return 'success'
+ }
+ </script>
<script src="../src/bean.js"></script>
<style>
#fixtures {
@@ -33,4 +39,4 @@
</div>
</div>
</body>
-</html>
+</html>
View
8 tests/tests.js
@@ -2,6 +2,14 @@ if (!window.console) {
window.console = { log: function () {}}
}
+sink('no conflict', function (test, ok) {
+ test('should return old bean back to context', 1, function () {
+ var b = bean.noConflict();
+ ok(bean() == 'success', 'old bean called');
+ window.bean = b;
+ });
+});
+
sink('add', function (test, ok) {
test('add: should return the element passed in', 1, function () {
Something went wrong with that request. Please try again.