Skip to content

Problems with handling single quotes? #166

Closed Answered by rejetto
SanokKule asked this question in Q&A
Discussion options

You must be logged in to vote

well, i experimented a bit, and the correct way should be

`<button onclick='videoplay(${JSON.stringify(entry.n).replace(/'/g, '&apos;')})'>+</button>`

Please confirm it works for you.
It is rather complicated, I know, so I decided that from next version you'll be able to do this

HFS.onEvent('afterEntryName', ({ entry }, { _ }) =>
    `<button onclick='videoplay("${_.escape(entry.n)}")'>+</button>`)

Anyway, this problem is due to the fact that we are trying to produce correct HTML.
The plugin can generate content as HTML, but also with pure javascript or React.
In fact, my simple-player plugin has no such problem, as it works with react

h('button',{ className: 'play-button', onClick: () …

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@SanokKule
Comment options

@SanokKule
Comment options

@SanokKule
Comment options

Answer selected by SanokKule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #160 on March 18, 2023 16:03.