From ec52288f5ecb95a01fa3bbc069c07aeb409db518 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Mon, 12 Jan 2015 12:31:32 -0800 Subject: [PATCH] Fix `http://docs.meteor.com/#/full/template_$` URL detection Fixes #3268 --- docs/client/links.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/client/links.js b/docs/client/links.js index 0149f5ed12..8b0651991b 100644 --- a/docs/client/links.js +++ b/docs/client/links.js @@ -80,7 +80,11 @@ Tracker.autorun(function () { // the same time but they are still both in the DOM. New browsers allow us // to query by id even if ids repeat themselves. We cannot change it // easily because the markdown parser always produces an id for headings. - var selector = "#main>:not(.hidden) #" + id; + var cssEscape = function (selector) { + // XXX maybe use https://github.com/mathiasbynens/CSS.escape/blob/master/css.escape.js? + return selector.replace(/\$/g, "\\$"); + }; + var selector = "#main>:not(.hidden) #" + cssEscape(id); var foundElement = $(selector); if (foundElement.get(0)) { targetLocation = $(".main-content").scrollTop() + foundElement.offset().top - $(".main-content").offset().top;