JSFiddle - React, Tailwind, and code Playground

by vpetrychuk

HTML

<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://backbonejs.org/backbone-min.js"></script>
<div class="box2">
	content
</div>

CSS

body {
	margin: 10px;
    font: 13px/1.3 Arial;
}

JavaScript

var BoxView = Backbone.View.extend({
  el : '.box2',
  template : function() {
    return new Array(9999).join('content ')
  },
  render : function () {
    this.$el.html(this.template());
  }
});

_.delay(function() {
    
   // bad way (delay that causes white screen)
   // $('.box2').empty();
    
    _.defer(function() {
      // make div empty before render content will avoid white screen
      // actually you can remove this line because `.box2` html will be replaced
      $('.box2').empty();
      (new BoxView).render();
    });
    
}, 500)