Closed html5css3 closed 12 years ago
The easiest workaround I can think of is not extending $ with underscore methods. Probably it shouldn't be done anyway - otherwise, this is prone to happen with other methods like map(), first() or last(). Specifically, underscore.find() is hugely different from bonzo.find() - and they both will be mapped to $.find
At this point I am willing to assume that underscore requires an ender bridge that does not augment the ender object (keeping $ and _ separate), but I could find that is out of the question.
Maybe ender should not extend the $ object automatically. I can do that easily by adding my own script at the end of the chain, e.g.:
var $ = ender;
$.ender(require('qwery'));
$.ender(require('bonzo'));
$.ender(require('reqwest'));
var B = require('backbone')
, _ = require('underscore')
This would give me control over the method overlapping.
i return this
because it seemed more useful, and had nothing to do with compliance. i don't think i'm going to change this, but i really appreciate the deep dive and full explanation.
At this point I am not really affected by this bug anymore, but just to make the point clear: if you use
ender build domready bonzo bean qwery underscore
Methods like $('div').html('foo') will be broken. The only solution I could find was NOT to extend $ with the methods of the included library (in this case, underscore), unless it includes an ender bridge.
As I said, this problem no longer affects me (I have gone other ways since) and I see it more of an ender issue than bonzo.
i'll have to try out that scenario and see how it breaks. bonzo should be using it's own each, and not underscores.
bonzo implementation of each() returns
this
, but underscore is now returningundefined
instead (which is coherent with the latest state of ECMAScript 5, see http://ie.microsoft.com/testdrive/HTML5/ECMAScript5Array/Default.html ). This is breaking some implementations, notably empty() and html().It has been reiterated that underscore is not intending to change their implementation, see
https://github.com/documentcloud/underscore/issues/73 https://github.com/documentcloud/underscore/issues/74 https://github.com/documentcloud/underscore/issues/142
I suppose that bonzo should also abide by this contract or push to change the standard (I agree that returning
undefined
is useless, but that is hardly the point here)