Files
react-native-devtools-frontend/front_end/component_docs/elements_breadcrumbs/scroll.html
T
Jack Franklin 1e53cb87ed Load runtime stylesheets in to the components server
Change-Id: I0f24656ae941f0ade4a3fd40d024a2420142e068
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354090
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-20 11:39:24 +00:00

97 lines
2.6 KiB
HTML

<!--
Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Scrolling breadcrumbs example</title>
<style>
#container {
width: 400px;
border: 1px solid black;
}
</style>
</head>
<body>
<div id="container">
</div>
<script type="module">
import * as ComponentHelpers from '../../component_helpers/component_helpers.js';
import {ElementsBreadcrumbs} from '../../elements/ElementsBreadcrumbs.js';
ComponentHelpers.ComponentServerSetup.setup().then(() => renderComponent())
const renderComponent = () => {
let id = 0;
const makeCrumb = (overrides = {}) => {
const attributes = overrides.attributes || {};
const newCrumb = {
nodeType: Node.ELEMENT_NODE,
id: id++,
pseudoType: '',
shadowRootType: '',
nodeName: 'body',
nodeNameNicelyCased: 'body',
legacyDomNode: {},
highlightNode: () => {},
clearHighlight: () => {},
getAttribute: x => attributes[x] || '',
...overrides,
};
return newCrumb;
};
const component = new ElementsBreadcrumbs();
const bodyCrumb = makeCrumb({
nodeType: Node.ELEMENT_NODE,
nodeName: 'body',
nodeNameNicelyCased: 'body',
attributes: {
class: 'body-class1 body-class2'
}
});
const divCrumb = makeCrumb({
nodeType: Node.ELEMENT_NODE,
nodeName: 'div',
nodeNameNicelyCased: 'div',
attributes: {
id: 'test-id',
class: 'wrapper-div',
},
});
const spanCrumb = makeCrumb({
nodeType: Node.ELEMENT_NODE,
nodeName: 'span',
nodeNameNicelyCased: 'span',
attributes: {
id: 'my-span-has-a-long-id',
},
});
const emCrumb = makeCrumb({
nodeType: Node.ELEMENT_NODE,
nodeName: 'em',
nodeNameNicelyCased: 'em',
attributes: {
id: 'my-em-has-a-long-id',
},
});
document.getElementById('container').appendChild(component);
component.data = {
crumbs: [emCrumb, spanCrumb, divCrumb, bodyCrumb],
selectedNode: bodyCrumb,
};
};
</script>
</body>
</html>