{"route":"/en-US-v0.14.1/reference/introspection/locate/","title":"Locate","description":"Documentation for the `locate` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"examples","name":"Examples","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-selector","name":"selector","children":[]}]}],"body":{"kind":"func","content":{"path":[],"name":"locate","title":"Locate","keywords":[],"oneliner":"Determines the location of an element in the document.","element":false,"contextual":true,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Determines the location of an element in the document.</p>\n<p>Takes a selector that must match exactly one element and returns that\nelement's <a href=\"/en-US-v0.14.1/reference/introspection/location/\" title=\"`location`\"><code>location</code></a>. This location can, in particular, be used to\nretrieve the physical <a href=\"/en-US-v0.14.1/reference/introspection/location/#definitions-page\"><code>page</code></a> number and\n<a href=\"/en-US-v0.14.1/reference/introspection/location/#definitions-position\"><code>position</code></a> (page, x, y) for that element.</p>\n<h2 id=\"examples\">Examples</h2>\n<p>Locating a specific element:</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">context</span> <span class=\"typ-punct\">[</span>\n  Introduction is at: <span class=\"typ-escape\">\\</span>\n  <span class=\"typ-func\">#</span><span class=\"typ-func\">locate</span><span class=\"typ-punct\">(</span><span class=\"typ-label\">&lt;intro&gt;</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">position</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">]</span>\n\n<span class=\"typ-heading\">= Introduction</span> <span class=\"typ-label\">&lt;intro&gt;</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/7e2cf137b2fb2fb13cb96a5377cfe632.png\" alt=\"Preview\"></div></div>"}],"self":false,"params":[{"name":"selector","details":[{"kind":"html","content":"<p>A selector that should match exactly one element. This element will be\nlocated.</p>\n<p>Especially useful in combination with</p>\n<ul>\n<li><a href=\"/en-US-v0.14.1/reference/introspection/here/\" title=\"`here`\"><code>here</code></a> to locate the current context,</li>\n<li>a <a href=\"/en-US-v0.14.1/reference/introspection/location/\" title=\"`location`\"><code>location</code></a> retrieved from some queried element via the\n<a href=\"/en-US-v0.14.1/reference/foundations/content/#definitions-location\"><code>location()</code></a> method on content.</li>\n</ul>"}],"types":["label","selector","location","function"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["location"],"scope":[]}}}