Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix and suffix renders twice #1036

Open
signalpoint opened this issue Mar 3, 2021 · 0 comments
Open

Prefix and suffix renders twice #1036

signalpoint opened this issue Mar 3, 2021 · 0 comments

Comments

@signalpoint
Copy link
Owner

If you are using a Bucket, and then try to use a render element that contains a Bucket, the prefix and suffix will be rendered twice.

var bucketContent = {
  _prefix: '<div class="foo">',
  _suffix: '</div>',
  stuff: {
    _theme: 'bucket',
    _attributes: {
      id: 'my-bucket'
    },
    /* ... */
  }
};
fill(bucketContent);

You'll end up with html like this:

<div class="foo">
  <div class="foo">
    <div id="my-bucket">...</div>
  </div>
</div>

This may be a problem with dg.render() itself and not limited to just the Bucket widget.

The workaround is to use _markup instead of _theme:

var bucketContent = {
  _prefix: '<div class="foo">',
  _suffix: '</div>',
  stuff: {
    _markup: dg.theme('bucket', {       
       _attributes: {
          id: 'my-bucket'
        },
        /* ... */
    })
  }
};
fill(bucketContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant