 if global.isServer
   BaseView::_ensureElement = noop
   BaseView::delegateEvents = noop
-
-htmlEscape = (str) ->
-  String(str)
-    .replace(/&/g, '&amp;')
-    .replace(/"/g, '&quot;')
-    .replace(/'/g, '&#39;')
-    .replace(/</g, '&lt;')
-    .replace(/>/g, '&gt;')
-

          value = value.id
        else if key is 'collection'
          key = 'collection_params'
          value = htmlEscape(JSON.stringify(value.params))
        if !_.isObject(value) && !_.include(@nonAttributeOptions, key)
          attributes["data-#{key}"] = htmlEscape(value)

    attributes


      $el = $(el)
      if !$el.data('view-attached')
        viewName = $el.data('view')
        options = {}
        for own key, value of $el.data()
          parsed = _.unescape(value)
          if parsed[0] is '{'
            try
              parsed = JSON.parse(parsed)
            catch e
          options[key] = parsed
        options.app = app
        ViewClass = BaseView.getView(viewName)
        view = new ViewClass(options)
