Ember.js Prototype Conflict
by Gerry Cardinal III
HTML
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script>
// copy the original function
var ext = Function.prototype.extend;
// remove it
delete Function.prototype.extend;
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
// Copy the jQuery version
var jqext = jQuery.prototype.extend;
// remove it (for sanity).
delete jQuery.prototype.extend;
// reassign the original function.
Function.prototype.extend = ext;
// remove the jQuery extend method (now the original Function.extend method)
delete jQuery.prototype.extend;
// reassign jQuery's original extend method.
jQuery.prototype.extend = jqext;
</script>
<script>
Ember = { imports: { jQuery: jQuery.noConflict(1) } };
</script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<script src="http://builds.emberjs.com/ember-data-latest.js"></script>
<body>
<script type="text/x-handlebars">
<h2>Welcome to Ember.js</h2>
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
<ul>
{{#each item in model}}
<li>{{item}}</li>
{{/each}}
</ul>
</script>
</body>
JavaScript
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexRoute = Ember.Route.extend({
model: function() {
return ['red', 'yellow', 'blue'];
}
});