Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Img attributes with single quotes result in invalid tags #19

Open
vegetabill opened this issue Oct 28, 2015 · 0 comments
Open

Img attributes with single quotes result in invalid tags #19

vegetabill opened this issue Oct 28, 2015 · 0 comments

Comments

@vegetabill
Copy link

var trunc = require("html-truncate")
trunc("<p>osito<img src='http://example.com/img.jpg' width='100'/>oscuro</p>", 8)

Results in:

'<p>osito<im…</p>'

Note the truncated img tag. I tried it with and without keepImageTag and it didn't make a difference.

When you use double quotes for the src and width attributes, it behaves as expected. I tried the example with html-ellipsis and the above works as expected, preserving the img tag.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant