[openstreetmap/openstreetmap-website] Propagate iD title to parent (PR #5865)
Anton Khorev
notifications at github.com
Sun Mar 30 18:16:36 UTC 2025
@AntonKhorev commented on this pull request.
> @@ -76,5 +76,13 @@ document.addEventListener("DOMContentLoaded", function () {
const data = parent.OSM.mapParams();
goToLocation(data);
});
+
+ const firstParentTitle = parent.document.title;
+ new MutationObserver(function (mutations) {
+ if (!mutations.some(mutation => mutation.target.tagName === "TITLE")) return;
+ const newTitle = `${document.title} | ${firstParentTitle}`;
+ if (parent.document.title === newTitle) return;
+ parent.document.title = newTitle;
+ }).observe(document.head, { childList: true, subtree: true });
Maybe also watch for `characterData`. Currently there's no difference because the title is changed by deleting the text node and creating a new one, but its going to be undetected if done by a node value change. I don't know how likely it's for iD to do that.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5865#pullrequestreview-2727975738
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5865/review/2727975738 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250330/833ce201/attachment.htm>
More information about the rails-dev
mailing list