Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

noWrap:true doesn't work properly in subviews when top-level element in template is not div #853

Closed
szelga opened this issue Apr 9, 2015 · 2 comments

Comments

@szelga
Copy link

szelga commented Apr 9, 2015

subview_template.jade:

tr
  td some text
  td more text

subview.coffee:

View = require 'lib/views/view'

module.exports = class SubView extends View
  noWrap: true
  template: 'subview_template'

mainview_template.jade:

table.table
  thead
    tr
      th some text
      th some text
  tbody.subview

mainview.coffee:

View = require 'lib/views/view'
SubView = require 'subview'

module.exports = class MainView extends View
  template: 'mainview_template'
  regions:
    'subview': '.subview'
  render: ->
    super
    sub_view = new SubView {autoRender: false, region: 'subview'}
    @subview 'sub_view', sub_view
    sub_view.render()

when i render the main view, i get "There must be a single top-level element when using noWrap." error. if i change the top-level element in subview_template to div, it "works" (doesn't properly work, but throws no error). Chaplin 1.0.0, Backbone 1.1.2.

@szelga
Copy link
Author

szelga commented Apr 9, 2015

found a workaround: using divs with display: table-row and display: table-cell instead of tr and td but this bug is annoying as hell. and noWrap property is confusing nevertheless.

@szelga
Copy link
Author

szelga commented Apr 9, 2015

sorry, my fault. read docs on noWrap once again, and now it's less confusing.

@szelga szelga closed this as completed Apr 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant