-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
reduce direct html injection, add escaping where necessary #8817
Conversation
these are in html because they contain links to osm user profiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these extensive changes. I haven’t gotten a chance to look through the whole PR, but here’s a couple things that I noticed at a glance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good as far as I can tell.
by using d3 to insert the localized text spans directly into the DOM
The UI glitches seem to be resolved now. Only a few small todos are now left (see top comment). There's quite a bit more |
fixes #8813 by:
lang
attribute to translated text #7998) so thathtml
is only used when necessary and safe.t.html(…)
.t.html
now escapes allreplacement
strings, except when they are explicitly marked ashtml
code.d3_selection.html
with a new method that directly and safely appends the localized text to the dom: ~selection.html(t.html("…"))
→selection.call(t.append("…"))
encodeURIComponent
thanks @1ec5todo:
t.append
method