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
Popover breaks when multiline template literal is used. #233
Comments
Perhaps you didn't NAME the option? this.popover = new Popover(ribbonElement, {template: template, placement: 'left'}); |
This is in the chrome console which supports property shorthand. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Property_definitions So our 2 examples are functionally the same. |
here's a fiddle reproducing the bug https://jsfiddle.net/jonfleck/obskwpta/14/ |
I will have a look at this asap. Thanks for reporting. |
OK so I've done some changed to your fiddle example, it's set (and I think it was) to pure JS, and it's working as expected:
All looks good to me now. The previous notation wasn't proper JavaScript, the |
The backtick is valid syntax. It was introduced to JavaScript to make templating easier. From the docs: “The default function just concatenates the parts into a single string.” https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals |
If that's the case, you're free to do any contribution you consider fit to solve that particular issue. I still think this backtick support isn't fully implemented in our browsers, or else it should work, nothing to do with our component at all. |
This issue comes up for me when the string starts with a line break. const template = `<div class="popover" role="tooltip">
<div class="arrow"></div>
<h3 class="popover-title"></h3>
<div class="popover-content"></div>
</div>`; Alternatively using |
|
@jcorporation what do you suggest? |
trim only, if contentString != null |
@jcorporation please test latest master. Thanks
@jcorporation please test latest master. Thanks
@thednp: works for me, thanks |
When I initialize a popover with a multiline string:
I get the error 'Cannot read property 'offsetWidth' of null' from this line of code:
arrowWidth = arrow[offsetWidth]; arrowHeight = arrow[offsetHeight];
The text was updated successfully, but these errors were encountered: