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

escaping of attrs #243

Open
ToeiRei opened this issue May 6, 2019 · 3 comments
Open

escaping of attrs #243

ToeiRei opened this issue May 6, 2019 · 3 comments
Assignees

Comments

@ToeiRei
Copy link

ToeiRei commented May 6, 2019

I'm currently trying to add a menu to log out - laravel auth Package style:

$menu->add( __('Logout'), route('logout')) 
                 ->attr(['class' => 'nav-item'])
                 ->prepend('<i class="fas fa-sign-out-alt"></i><span>')
                 ->append('</span>')
                 ->link->attr(['class' => 'nav-link', 'onClick' => 'event.preventDefault(); document.getElementById(\'logout-form\').submit();']);

So far no big deal until I noticed the ' being escaped, breaking code.

@dustingraham
Copy link
Collaborator

Howdy, I don't have time to dig into this and look at how it's working.

One quick option that comes to mind is you could add a class or id, and then bind the on-click in javascript after page load using the class or id, instead of adding it inline.

@ToeiRei
Copy link
Author

ToeiRei commented May 6, 2019

It took me quite a while to figure out why things were broken - the workaround via binding an id is already in place. Just thought I'd report that behavior as I am not sure if it's a bug or feature and obviously not me to decide.

@dustingraham
Copy link
Collaborator

Great thanks, I'll leave this open for review.

@dustingraham dustingraham self-assigned this May 6, 2019
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

2 participants