Skip to content

Instantly share code, notes, and snippets.

@elucid
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elucid/9840553 to your computer and use it in GitHub Desktop.
Save elucid/9840553 to your computer and use it in GitHub Desktop.
Paste this in the console of a running ember.js app to detect broken markup
// see https://gist.github.com/raycohen/2296605
// see https://github.com/mahonnaise/b0rked.js
var b0rked = 'https://raw.githubusercontent.com/mahonnaise/b0rked.js/master/b0rked.js';
var script= document.createElement('script');
script.type = 'text/javascript';
script.src = b0rked;
document.head.appendChild(script);
var logIfB0rked = function(s) {
var message = b0rked(s);
if (message) {console.warn(message);}
};
Ember.View.reopen({
afterRender: function(buffer) {
logIfB0rked(buffer.string());
}
});
Ember._Metamorph.reopen({
afterRender: function(buffer) {
buffer.push(this.morph.endTag());
logIfB0rked(buffer.string());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment