Skip to content

Conversation

@adrianbj
Copy link
Contributor

No description provided.

@JanTvrdik
Copy link
Contributor

Why not just use textContent instead of innerHtml?

@adrianbj
Copy link
Contributor Author

Why not just use textContent instead of innerHtml?

It might be totally fine. I have just read several things on the browser inconsistencies with textContent so thought that a regex replace would be safer.

http://perfectionkills.com/the-poor-misunderstood-innerText/
http://clubajax.org/plain-text-vs-innertext-vs-textcontent/

In particular the line break discrepancies. It probably won't be an issue in this use case, but you can never be certain what a panel author may put inside the h1 tags.

@dg
Copy link
Member

dg commented Jun 26, 2016

Problem with regexp is that it is not safe, ie. <span title=">"> will not be stripped correctly.

Whitespace inside <title> is compessed, so textcontent should be fine.

@dg dg merged commit 841aff7 into nette:master Jun 28, 2016
@dg
Copy link
Member

dg commented Jun 28, 2016

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants