GithubHelp home page GithubHelp logo

Comments (6)

Alex-Shilman avatar Alex-Shilman commented on May 3, 2024 1

It would be great to set tagName: false similarly how we do template: false

from backbone.marionette.

mxriverlynn avatar mxriverlynn commented on May 3, 2024

this is generated by Backbone's views, and isn't specific to Marionette. When a Backbone view is created, it will generate a <div> for you, in it's el attribute. You can specify any tag name you want using the tagName attribute on the view. Or if you don't want backbone to to use it's generated element, you can replace it by calling setElement(...) on the view or by configuring the el attribute in the view definition.

from backbone.marionette.

ludovicbret avatar ludovicbret commented on May 3, 2024

thank you !

from backbone.marionette.

omares avatar omares commented on May 3, 2024

Hey, i am loading templates via the requirejs text plugin. My template includes the outer div and all its classes, so when rendering the region i also get an extra div (which tbh doesnt hurt much but i would like to remove it).

The perfect option would be to tell the view to use the outer div of my template. How could i solve that? Or is this a no go?

from backbone.marionette.

mxriverlynn avatar mxriverlynn commented on May 3, 2024

same way: call setElement and pass in the final HTML that you want the view to have.

from within Marionette's views, you could do this in the onRender event, or override the render method to do this for you

from backbone.marionette.

laurentdebricon avatar laurentdebricon commented on May 3, 2024

Just a little sum up of my inquiry :
Marionette View inherit from BackboneView, and sadly : http://backbonejs.org/docs/backbone.html#section-158, Backbone call "this._ensureElement();" which create a div if no el is provided.

So If you don't want a div that wrap your template :

<script type="text/html" id="myTemplate">
<h4 class="myClass">Hello Marionnette<h4>
</script>

change it to :

<script type="text/html" id="myTemplate">
Hello Marionnette
</script>

and edit your View and provide "el : "<h4 class='myClass'>" in your View properties.
Or tagName : "h4", className : "myClass"

I hope this helps someone :)

from backbone.marionette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.