Replace id
attribute with name
for <meta>
tag
This commit is contained in:
parent
b8e4c54ffb
commit
acbfb8c3bd
@ -1525,7 +1525,6 @@ fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> {
|
||||
map.insert("toggle-all-docs".into(), 1);
|
||||
map.insert("all-types".into(), 1);
|
||||
map.insert("default-settings".into(), 1);
|
||||
map.insert("rustdoc-vars".into(), 1);
|
||||
map.insert("sidebar-vars".into(), 1);
|
||||
map.insert("copy-path".into(), 1);
|
||||
map.insert("TOC".into(), 1);
|
||||
|
@ -3,13 +3,13 @@
|
||||
|
||||
// Local js definitions:
|
||||
/* global addClass, getCurrentValue, onEachLazy, removeClass, browserSupportsHistoryApi */
|
||||
/* global updateLocalStorage */
|
||||
/* global updateLocalStorage, getVar */
|
||||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
const rootPath = document.getElementById("rustdoc-vars").attributes["data-root-path"].value;
|
||||
const rootPath = getVar("root-path");
|
||||
|
||||
const NAME_OFFSET = 0;
|
||||
const DIRS_OFFSET = 1;
|
||||
|
@ -108,7 +108,7 @@ function getCurrentValue(name) {
|
||||
// Get a value from the rustdoc-vars div, which is used to convey data from
|
||||
// Rust to the JS. If there is no such element, return null.
|
||||
const getVar = (function getVar(name) {
|
||||
const el = document.getElementById("rustdoc-vars");
|
||||
const el = document.querySelector("head > meta[name='rustdoc-vars']");
|
||||
return el ? el.attributes["data-" + name].value : null;
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
{% endfor %}
|
||||
></script> {# #}
|
||||
{% endif %}
|
||||
<meta id="rustdoc-vars" {#+ #}
|
||||
<meta name="rustdoc-vars" {#+ #}
|
||||
data-root-path="{{page.root_path|safe}}" {#+ #}
|
||||
data-static-root-path="{{static_root_path|safe}}" {#+ #}
|
||||
data-current-crate="{{layout.krate}}" {#+ #}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// @has test.css
|
||||
// @has foo/struct.Foo.html
|
||||
// @has - '//*[@id="rustdoc-vars"]/@data-themes' 'test'
|
||||
// @has - '//*[@name="rustdoc-vars"]/@data-themes' 'test'
|
||||
pub struct Foo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user